On 10/04/17 16:57, Michael Vermaes wrote:
On Fri, Apr 7, 2017 at 7:51 PM, Laurentiu Pancescu lpancescu@gmail.com wrote:
I would prefer the second option, using VBoxManage to produce small non-sparse .VHD images for our Vagrant boxes, and avoid the compatibility problems posed by sparse files. But this would need to be done in Image Factory, so it's actually for Ian to decide if using VirtualBox is acceptable.
After using qemu-img to convert the qcow2 image to VHD and then extracting the resulting tar file on the Hyper V host, the resulting image was back to being 40GB 'non-sparse'.
Using VBoxManage instead, 'vagrant up' time was reduced to be comparable to the kozo/centos7 box: [snip] So I would also say the second option is the way to go if possible :)
qemu-img has several options for the vpc and vhdx formats ("qemu-img convert -O vpc -o ?" will show them). Earlier today I tried all possible combinations of subformat, preallocation and block_state_zero, without any visible effect: it always produces sparse files for vpc (.vhd) and huge non-sparse file for .vhdx.
qemu-img seems to be right to produce sparse .vhd files, if I correctly understand the documentation from libvhdi. [1] VirtualBox doesn't, but what they're doing seems to work better in practice.
[1] https://github.com/libyal/libvhdi/blob/master/documentation/Virtual%20Hard%2...
Any thoughts about using VBoxManage to convert the images to .vhd? VirtualBox supports neither .vhdx nor QCOW2, so we'd need to convert via .vmdk or another format.