[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] Why is QEMU disk geometry limited to 16 heads

From: Dmitry Grigoryev
Subject: Re: [Qemu-discuss] Why is QEMU disk geometry limited to 16 heads
Date: Mon, 13 Apr 2015 15:09:10 +0300

Hi again,

I think my particular problem is related to this "virtual" geometry returned by SeaBIOS, and which apparently cannot be set directly from command line. My image file is quite small (under 4GB), this size doesn't justify the use of 255 heads. Nevertheless, this value (255 heads) is written in the partition table and also in the BPB (BIOS parameter block) of the FAT32 partition with OS installed on it.

So I suppose SeaBIOS decides to use a geometry which doesn't match the one expected by OS bootloader. Is there a way to verify which geometry is used and/or force it to particular values? This is something I would normally do via BIOS setup utility.



On 10/04/2015 19:11, Dmitry Grigoryev wrote:

I have a disk image which won't run with QEMU. Its CHS formula is 510,255,63 isn't recognized automatically, and whenever I specify -drive file=image.raw,cyls=510,heads=255,secs=63 QEMU exits saying "invalid physical heads number".

Is there a reason why head count above 16 isn't supported? Is there a workaround to make my image usable by QEMU without losing the data?

PC historic fact: The ATA hard disk interface (electrical/register programming) is limited to max 16384 cyls, 16 heads, 63 sectors in CHS mode, 16Mi (16 binary millions)  sectors in LBA24 mode and 256Ti (16 binary Terra) sectors in LBA48 mode.  The historic BIOS INT 13h Hard disk API is limited to 1024 cyls, 255 heads, 63 sectors in CHS mode, and a lot (I guess 2**64) of sectors in LBA mode.  The historic BIOS INT 13h Floppy disk API was limited to 256 cyls, 255 heads, 255 sectors but only supported devices with 1 or 2 heads.
So whenever a PC BIOS (such as the SeaBios used in qemu PC-style virtual machines) is accessing an ATA disk > 1024 cylinders, it converts the number of cylinders and heads to a different multiplum such as 510 * 255 * 63 rather than the 8129 * 16 * 63 ATA CHS geometry or 8193150 ATA LBA24 sectors presented by the signals on the ATA cable.
Because qemu settings specify the virtual hardware, not the virtual BIOS, the CHS settings passed to qemu should be the "hardware" 8129 * 16 * 63 or just let qemu use the default for the number of LBA sectors in your image file.  Then the SeaBios inside the virtual machine will return that as 510 * 255 * 63 to the boot loader etc. for the few moments before those programs start talking to the "hardware" directly.

Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]