[Libguestfs] Opening compressed filesystems

Richard W.M. Jones
2014-05-16T16:30:35Z

This is in reply to a question on IRC about opening compressed disk
images.

This is already possible -- in fact quite easy -- using nbdkit.

It only works well for xz-compressed files which have been prepared
using the --block-size option like this:

  xz --best --block-size=16777216 disk.img

You can then run nbdkit as a captive process like this:

  nbdkit xz file=disk.img.xz \
    --run 'guestfish --format=raw -a $nbd -i'

or if you feel like it, boot the guest:

  nbdkit xz file=disk.img.xz \
    --run 'qemu-kvm -m 1024 -drive file=$nbd,if=virtio'

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.