New in virt-sparsify: In place sparsification

New in virt-sparsify ≥ 1.25.44, you can now sparsify disk images without copying them, so-called in-place sparsification.

It’s easy to use:

$ virt-sparsify --in-place fedora.img
Trimming /dev/sda1 ...
Clearing Linux swap on /dev/sda2 ...
Trimming /dev/sda3 ...

Sparsify in-place operation completed with no errors.

… and much faster. However it does require very recent kernel and qemu support.

Thanks: Paolo Bonzini, Eric Sandeen & Kevin Wolf for implementing discard support and patiently helping out when we started to test and use it.

18 Comments

Filed under Uncategorized

18 responses to “New in virt-sparsify: In place sparsification

  1. That’s fantastic. The disk usage of virt-sparsify has often frustrated or stumped me before now. Thanks!

  2. Does it work with kernel-3.13.6-200.fc20.x86_64 and qemu-system-x86-1.7.0-5.fc20.x86_64?

  3. Pingback: libguestfs 1.26 released | Richard WM Jones

  4. Pingback: libguestfs RHEL 7.1 preview packages (yes, really) | Richard WM Jones

  5. One more question: is --in-place mode less efficient than the regular one?

    • rich

      It depends on how you define efficient. In the usual sense, yes it’s far more efficient. It uses far less host resources to do in-place sparsification.

      However it’s not as “efficient” at finding opportunities to free space and sparsify guests. For some filesystems in-place sparsification won’t work at all (ie. no extra space can be found unless it is already zero) because we require that the fstrim ioctl has been implemented for every filesystem in the Linux driver for that filesystem.

      Even for ext4 where fstrim has been implemented, the fstrim implementation in the kernel unfortunately does not free up the journal (whereas copying-mode can), so there’s some opportunity for improvement. As usual patches welcome — in this instance, to the linux kernel mailing list.

  6. Pingback: virt-v2v: better living through new technology | Richard WM Jones

  7. Yogesh Sharma

    One good options to add it –continue-on-error I have thin lvm based CentOS 7 KVM image where first partition is /boot, second is SWAP and third is / it fails on SWAP and exits with continue options even on error it will try on next partition.

    Second issue that I have is it fails to sparsify windows 7 ntfs disk. I have seen discussion about your Block Discard patch for NTFS but not sure on its commit status. I do is ntfsresize to minimum, create a linux partition, mkfs.ext4 (it will call discard first) delete linux partition, resize ntfs partition back to full.

  8. Does virt-sparsify work on vmdk files?

    • rich

      Probably. virt-sparsify just uses qemu, so we support whatever qemu supports, and qemu supports certain types of VMDK (the “standard” is not very well standardized, and a moving target). If trying to sparsify VMDK, then definitely use copying mode, and not --in-place.

  9. Shakisha

    how to install this version on centos 6.7?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s