====== Create mountable compressed disk image ====== - Install tools apt install -y qemu-utils libguestfs-tools - Sparsify the disk virt-sparsify -v --in-place disk.img - Convert the disk to dynamic VHD qemu-img convert -p -o subformat=dynamic -f raw -O vpc disk.img disk.vhd ===== Batch ===== for i in *.img; do virt-sparsify -v --in-place $i; done for i in *.img; do echo $i; qemu-img convert -p -o subformat=dynamic -f raw -O vpc "$i" "${i%%.img}.vhd"; done ===== See Alsos ===== - http://libguestfs.org/virt-sparsify.1.html - https://docs.openstack.org/image-guide/convert-images.html {{tag>disk-image libguestfs qemu-img}}