I have Ubuntu installed on an SSD in my laptop. I've decided I want to install Windows instead of Linux, and to run Linux as a VM guest on Windows using Virtualbox. The SSD is 256GB, of which only about 60GB in total is used by the various partitions on the disk. The rest of the space is simply unallocated.
I was thinking of using dd to convert the installation to an image file, and then convert the image file to a VDI file using the virtualbox management tools.
dd if=/dev/sdb of=/VMs/sdb.img
The problem is that dd takes complete copy of the disk, including the unused space; in my case the image file will have the same 256GB size as the original SSD. I would like to reduce the size of this image file. Is there a way to do this using dd (or any other tool)?. I've noticed dd's count option. Can this be used?
I've googled this, and the emphasis seems to be on intermediate
file size for file transportation purposes, which can be reduced by piping dd's output through gzip. But this won't affect the actual image file size.