Skip to contentSkip to conversation

Booting a partition image (not a disk image)?

Qemu-devel Richard Neill 2 participants 2 messages Nov 13, 2005

lore
Share & tools
lore
#0 lore raw

Dear All,

I hope this isn't a stupid question, but I can't find the answer to it anywhere. I have copied across the windows ME partition from an old machine, using
dd if=/dev/hda2 | ssh me@newbox "cat > hda2.img"
This has worked, and I can mount the filesystem fine.

Is there any way I can boot this image using QEMU? i.e. there is no boot
sector, and I've not copied the rest of the drive to save space.

The obvious solution doesn't work:
qemu -boot c -snapshot -hda hda2.img

Thanks very much,

Richard

Signature · 2 lines
[email protected]  **  http://www.richardneill.org
Richard Neill, Trinity College, Cambridge, CB21TQ, U.K.
#1 lore raw
Quoted 11 lines · Richard Neill

Dear All,

I hope this isn't a stupid question, but I can't find the answer to it anywhere. I have copied across the windows ME partition from an old machine, using
dd if=/dev/hda2 | ssh me@newbox "cat > hda2.img"
This has worked, and I can mount the filesystem fine.

Is there any way I can boot this image using QEMU? i.e. there is no boot
sector, and I've not copied the rest of the drive to save space.

Quoted 7 lines

The obvious solution doesn't work:
qemu -boot c -snapshot -hda hda2.img

Thanks very much,

Richard

You need a boot sector in order to be able to boot the image.

Anyways, qemu requires a full hard disk image (MBR, partition table, etc) to be able to boot a disk image. If you must boot with hda2.img instead of a full hard disk image, there may be a way to work around that. (To be safe, I'd recommend making a copy of hda2.img first as a backup.)

You can dump out the MBR & partition table (first few sectors of the hard disk) into a file, and then append hda2.img to that file. Then load the image up in fdisk to "fix" the partition table (removing all the other partitions and giving the single partition the right start and end numbers). After that, things should work fine.

This is complicated, and may take a while to get right if you are new to playing with hard disk images.

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.