Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Are you trying to store your file on a FAT32 filesystem? –  jippie Apr 21 '12 at 6:26
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
have not tried. sounds would work. thanks ;) –  davidshen84 Apr 22 '12 at 3:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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