I am in the process of migrating windows installation to a VM. On the physical device with windows, there are two partitions: /dev/sda1
and /dev/sda2
. There's also a large amount of free space following the second partition.
I can create a virtual disk off the full /dev/sda
easily with this command:
cat /dev/sdg | VBoxManage convertfromraw stdin OutPutFile.vdi NUMBEROFBYTES
However this will create a huge file, which will include all the free space. I want the file to only include the two partitions. How can I do this? Alternatively, is there an option to resize down the virtual disk after it's created?