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 convert
operation.
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 convert
I came across the-c
option which may 'compress' the new file and (maybe also create a (sizewise) dynamic qcow2 image. – vrms Apr 18 '18 at 01:23virt-sparsify
to fix that. As for actually shrinking it, that's probably something you should do with Windows tools beforep2v
ing it. – Michael Hampton Apr 18 '18 at 01:39