Skip to contentSkip to conversation

"A disk read error occurred"

Qemu-devel Alexander (Sasha) Sirotkin 4 participants 10 messages Jun 28, 2008 – Jul 2, 2008

lore
Share & tools
lore
#0 lore raw

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Any suggestions ?

Thanks

#1 lore raw
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

Also, an strace can help show the problem.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#2 lore raw
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Quoted 4 lines

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

Also, an strace can help show the problem.

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

-- Jamie

#3 lore raw
Quoted 6 lines · Jamie Lokier

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

-- Jamie

The message "A disk read error occurred" comes from the NT bootloader when it is unable to boot, typically caused by an incorrect drive geometry.

It sounds as if you are experiencing a similar problem to the one I blogged about here: http://www.ilande.co.uk/index.php?/archives/6-Migrating-an-NT4-VM-from-VMWare-to-NT4-Part-1.html. In other words, in order to run an existing NT4 image under QEMU I had to halve the number of heads in the NTFS BPB in order for things to work properly. I suspect that this is a bug in either QEMU/BIOS, but I have no idea where to even start looking.

HTH,

Mark.

Signature · 4 lines
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
#4 lore raw
Quoted 10 lines · Mark Cave-Ayland
Quoted 6 lines

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

-- Jamie

The message "A disk read error occurred" comes from the NT bootloader when it is unable to boot, typically caused by an incorrect drive geometry.

Quoted 7 lines

It sounds as if you are experiencing a similar problem to the one I blogged about here:
http://www.ilande.co.uk/index.php?/archives/6-Migrating-an-NT4-VM-from-VMWare-to-NT4-Part-1.html.
In other words, in order to run an existing NT4 image under QEMU I had to halve the number of heads in the NTFS BPB in order for things to work properly. I suspect that this is a bug in either QEMU/BIOS, but I have no idea where to even start looking.

Yes, very similar, except I saw the problem _without_ migrating anything. Windows 2000 was installed _inside_ QEMU (with no special -hdachs setting) from its CD installer. It couldn't boot its own install after restarting QEMU.

I looked at the partition with fdisk, then copied the c,h,s values to -hdachs...

...and QEMU said the values were out of range and refused to start!

So I guessed some values which were not what fdisk reported, and it worked and booted fine.

-- Jamie

#5 lore raw
Quoted 5 lines · Jamie Lokier

Yes, very similar, except I saw the problem _without_ migrating anything. Windows 2000 was installed _inside_ QEMU (with no special -hdachs setting) from its CD installer. It couldn't boot its own install after restarting QEMU.

Quoted 7 lines

I looked at the partition with fdisk, then copied the c,h,s values to -hdachs...

...and QEMU said the values were out of range and refused to start!

So I guessed some values which were not what fdisk reported, and it worked and booted fine.

Yeah, I went through exactly the same process with -hdachs myself :) If you still have the broken image around, it would be interesting to compare the CHS settings between the MBR and VBR on your QEMU-installed copy to see what values you were getting...

ATB,

Mark.

Signature · 4 lines
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
#6 lore raw
In reply to Jamie Lokier
Quoted 10 lines · Jamie Lokier
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Quoted 2 lines
Quoted 2 lines

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

There are no printfs, no sector numbers, nothing. Just the above error.

Quoted 2 lines
Quoted 2 lines

Also, an strace can help show the problem.

The whole strace is too big, attaching last 1000 lines

Quoted 6 lines

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

I must say that I don't understand what chs values I should give to qemu. hdparm shows 9729/255/63, but fdisk insists on 10337,240,63. Both versions do not work with qemu, it says "invalid physical CHS format"
BTW, hdparm -i shows yet another version - RawCHS=16383/16/63

BTW, the disk is HTS541080G9SA00

Quoted 4 lines

-- Jamie

#7 lore raw
Quoted 24 lines · Alexander (Sasha) Sirotkin
Quoted 10 lines · Jamie Lokier
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Quoted 2 lines
Quoted 2 lines

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

There are no printfs, no sector numbers, nothing. Just the above error.

Quoted 2 lines
Quoted 2 lines

Also, an strace can help show the problem.

The whole strace is too big, attaching last 1000 lines

Quoted 6 lines

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

Quoted 5 lines

I must say that I don't understand what chs values I should give to qemu. hdparm shows 9729/255/63, but fdisk insists on 10337,240,63. Both versions do not work with qemu, it says "invalid physical CHS format"
BTW, hdparm -i shows yet another version - RawCHS=16383/16/63

Try -hdachs 1023,16,63,lba.
If that doesn't work, try it without lba.
If those don't work, try 255 for the middle number, with/without lba.

-- Jamie

#8 lore raw
Quoted 31 lines · Jamie Lokier
Quoted 24 lines · Alexander (Sasha) Sirotkin
Quoted 10 lines · Jamie Lokier
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Quoted 2 lines
Quoted 2 lines

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

There are no printfs, no sector numbers, nothing. Just the above error.

Quoted 2 lines
Quoted 2 lines

Also, an strace can help show the problem.

The whole strace is too big, attaching last 1000 lines

Quoted 6 lines

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

Quoted 5 lines

I must say that I don't understand what chs values I should give to qemu. hdparm shows 9729/255/63, but fdisk insists on 10337,240,63. Both versions do not work with qemu, it says "invalid physical CHS format"
BTW, hdparm -i shows yet another version - RawCHS=16383/16/63

Quoted 3 lines

Try -hdachs 1023,16,63,lba.
If that doesn't work, try it without lba.
If those don't work, try 255 for the middle number, with/without lba.

qemu does not allow h numbers above 16, so I cannot use 255. 16 does not work...

Quoted 5 lines

-- Jamie

#9 lore raw
In reply to Jamie Lokier
Quoted 31 lines · Jamie Lokier
Quoted 24 lines · Alexander (Sasha) Sirotkin
Quoted 10 lines · Jamie Lokier
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Alexander (Sasha) Sirotkin

For some reason when I try to boot qemu with -hda /dev/sda (or -hda /dev/hda), i.e. to use the whole disk, it fails with the above error "A disk read error occurred". This happens only on IBM/Lenovo laptops (tried a few models), while it works just fine on any desktop I can get my hands on. Probably has something to do with bios...

Quoted 2 lines
Quoted 2 lines

Can you add some printfs displaying the sector numbers being read? Some disks have trouble accessing the last sector.

There are no printfs, no sector numbers, nothing. Just the above error.

Quoted 2 lines
Quoted 2 lines

Also, an strace can help show the problem.

The whole strace is too big, attaching last 1000 lines

Quoted 6 lines

Also, sometimes when booting the BIOS can print a disk read error message, and an appropriate -hdachs will fix it. I found that out when rebooting Windows 2000 after installing it from CD (both in QEMU), on a virtual disk 1GB in size.

Quoted 5 lines

I must say that I don't understand what chs values I should give to qemu. hdparm shows 9729/255/63, but fdisk insists on 10337,240,63. Both versions do not work with qemu, it says "invalid physical CHS format"
BTW, hdparm -i shows yet another version - RawCHS=16383/16/63

Quoted 4 lines

Try -hdachs 1023,16,63,lba.
If that doesn't work, try it without lba.
If those don't work, try 255 for the middle number, with/without lba.

According to the DiskEXplorer for NTFS the correct heads number is 240, however qemu does not allow to set it. Any idea why ? Can I just remove this limitation in the source code ?

Quoted 4 lines

-- Jamie