Skip to contentSkip to conversation

guest ATA errors on 'recently loopback built disk image'

Qemu-devel Ico 1 participant 2 messages Jun 1, 2010

lore
Share & tools
lore

Ico

author
#0 lore raw

(I hope this is the right place to go to with my question, if not please refer me to the proper mailing list)

short version:

kvm reports ATA errors on images which are newly built on a loopback disk image. If the image is copied to another file and booted, no problems occur

long version:

I'm building a linux guest image to run with kvm. The image is built using qemu-img, creating partitions and a filesystem, doing a loopback mount, copying the contents, installing extlinux bootloader and unmounting. The image contains a minimal ubuntu 10.04 'lucid' OS.

When booting the image, the guest OS continuously reports all kinds of ATA errors directly after mounting the root filesystem, something like

   [    2.307542] ata1.01: failed command: WRITE DMA                               
   [    2.308278] ata1.01: cmd ca/00:02:02:00:00/00:00:00:00:00/f0 tag 0 dma 1024 out                                                                              
   [    2.308279]          res 41/04:02:02:00:00/00:00:00:00:00/f0 Emask 0x1 (device error)                                                                        
   [    2.310704] ata1.01: status: { DRDY ERR }                                    
   [    2.311378] ata1.01: error: { ABRT }                                         
   [    2.314049] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0        
   [    2.314845] ata1.01: BMDMA stat 0x5                                          
   [    2.315536] ata1.01: failed command: WRITE DMA

and these go on and on. Eventually the OS boots half ok, with the root filesystem mounted read only because of the errors.

BUT

if i first copy the newly built image to a new filename, and boot from that, the guest boots just fine, no errors, no problems.

My guess is that 'something' still has its hands on the disk image, causing errors in kvm, but I'm not able to figure out what is happening here. The loopback device is unmounted and properly freed according to losetup, lsof/fuser report no processes having the image open, but still something causes this strange behaviour.

The image is built thus:

rm -f ${ROOT_IMG}
qemu-img create ${ROOT_IMG} 500M
/sbin/mkfs.ext3 -q -F ${ROOT_IMG}
/sbin/tune2fs -i0 -c0 ${ROOT_IMG}
mkdir -p mnt
mount -o loop ${ROOT_IMG} mnt
rsync -a root/ mnt/
cp src/extlinux.conf src/menu.c32 mnt/
extlinux -i mnt/
umount -d mnt

and booted like

    kvm -m 512 root.img

resulting in a lot of errors in the guest. If I do

cp root.img root2.img
kvm -m 512 root2.img

the guest boots just fine, no errors at all

So, what am I missing here ?

Thank you very much,

Ico

host:
i386, Debian, something between testing and unstable. kernel.org stock kernel, version 2.6.30

kvm version:
QEMU PC emulator version 0.12.4 (qemu-kvm-0.12.4), Copyright (c) 2003-2008 Fabrice Bellard

Signature · 2 lines
:wq
^X^Cy^K^X^C^C^C^C
author
#1 lore raw

* On 2010-06-01 Ico <[email protected]> wrote :

Quoted 5 lines

short version:

kvm reports ATA errors on images which are newly built on a loopback disk image. If the image is copied to another file and booted, no problems occur

Extra note: the created image is a sparse file. If I create the disk using dd /dev/zero, all is well and no disk errors are reported in the guest. This explains why the 'cp' solves as well, I guess.

Signature · 2 lines
:wq
^X^Cy^K^X^C^C^C^C