I want to convert a Windows 7 C:\ Drive from my previous laptop into a qcow2 image which I wan to use to create a KVM virtual machine from on a new (linux based) computer.
I guess the simplest way would be some sort of dd plus a qemu-img convertoperation.
1.) Boot the old W7 laptop from a live system and run:
dd if=/dev/sda1 of=/path/to/W7.img
(would I need to add any dd options to make that bootable? any other options [for blocksize i.e.]) recommended?)
2.) On the new machine say something like
qemu-img convert -f raw -O qcow2 /path/to/W7.img /path/to/W7.qcow2
that should give me a pretty exact copy with the same size of the C:\ drive I guess.
Now the original C:drive is quite large and half empty, so I'd like to have a dynamically expanding qcow2 image as an end result and likewise reduce it's size.
Is there any option I can add to the qemu-img convert operation which would help to achieve that?
qemu-img convertI came across the-coption which may 'compress' the new file and (maybe also create a (sizewise) dynamic qcow2 image. – vrms Apr 18 '18 at 01:23virt-sparsifyto fix that. As for actually shrinking it, that's probably something you should do with Windows tools beforep2ving it. – Michael Hampton Apr 18 '18 at 01:39