3

I know I can use qemu-img tool to convert a raw partition into a image file. But Windows 7 has two partitions. I tried:

qemu-img convert /dev/sda1 /dev/sda2 win7.qcow2

But the generated file does not have the correct partition infomation, thus cannot work. I also tried converting only the System partition and let the Windows 7 installation program to fix it for me, and the program says it cannot fix it ;(

I then used the disk2vhd utility to create VHD image, then tried to convert it into qcow2, but qemu-img returned error:

File too large.

The generated VHD image file is about 15GB. The file system I am working on is ext4. So I do not think it is a file system limit issue.

1
  • Are you trying to store your file on a FAT32 filesystem? – jippie Apr 21 '12 at 6:26
1

Perhaps you should do this in two steps:

First: Make an LV as raw disk, built a partition table there with entries that correspond to sda1 and sda2.

Make these partitions available: kpartx -av /dev/VG/LV

Use dd (propably with bs=1m) to copy sda1 to the first and sda2 to the second "partition".

Now you should have a raw-disk-image that corresponds to your physical windows partitions.

Try to use that LV as disk (sas, sata or scsi emulation).

If that works your second step is to convert the LV to a different container format.

1
  • have not tried. sounds would work. thanks ;) – David S. Apr 22 '12 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.