Differences

This shows you the differences between two versions of the page.

Link to this comparison view

topics:disk-image-compress-mountable [2017/03/26 03:46] (current)
orzfly created
Line 1: Line 1:
 +====== Create mountable compressed disk image ======
  
 +  - Install tools<​code bash>
 +apt install -y qemu-utils libguestfs-tools
 +</​code>​
 +  - Sparsify the disk<​code bash>
 +virt-sparsify -v --in-place disk.img
 +</​code>​
 +  - Convert the disk to dynamic VHD<code bash>
 +qemu-img convert -p -o subformat=dynamic -f raw -O vpc disk.img disk.vhd
 +</​code>​
 +
 +===== Batch =====
 +<code bash>
 +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
 +</​code>​
 +
 +===== See Alsos =====
 +  - http://​libguestfs.org/​virt-sparsify.1.html
 +  - https://​docs.openstack.org/​image-guide/​convert-images.html
 +
 +{{tag>​disk-image libguestfs qemu-img}}