The image from OpenStack Snapshot is usually much bigger than the used disk in the virtual machine. That is because a snapshot is the entire disk, so the snapshot will be much bigger than the original qcow image. How much bigger depends on what flavor you’re using and what changes you’re making to deploy the new kernel before you take the new snapshot.
Virt-sparsify is a tool which can make a virtual machine disk (or any disk image) sparse a.k.a. thin-provisioned. This means that free space within the disk image can be converted back to free space on the host.
Virt-sparsify can locate and sparsify free space in most filesystems (eg. ext2/3/4, btrfs, NTFS, etc.), and also in LVM physical volumes.
Virt-sparsify can also convert between some disk formats, for example converting a raw disk image to a thin-provisioned qcow2 image.
Virt-sparsify can operate on any disk image, not just ones from virtual machines. However if a virtual machine has multiple disks and uses volume management, then virt-sparsify will work but not be very effective (http://bugzilla.redhat.com/887826).
- How to install
sudo yum install libguestfs-tools # Fedora/RHEL/CentOS
- How to download snapshot as image
openstack image list
- How to resize the image
virt-sparsify --compress snapshot-image.raw resize-image.qcow2
More details can be found in below