[Libguestfs] [PATCH nbdkit 0/4] New plugin: Add linuxdisk plugin.

Richard W.M. Jones rjones at redhat.com
Tue Feb 19 07:49:05 UTC 2019

Turns out Japanese trains are good for coding!

In supermin we have a bunch of code to create the libguestfs
appliance.  It creates it directly using libext2fs (part of
e2fsprogs).  We can use the same technique to create ext2 virtual
disks in nbdkit, which is what this new plugin does.  Why a new plugin
instead of modifying the floppy plugin?  See the 4/4 commit message
for an explanation.

The first 3 patches are pretty uncontroversial refactoring.  The 4th
patch contains the plugin and tests.  It's probably best to start with
the commit message and the included man page.

This is quick even for relatively large filesystems containing large
numbers of small files.  Here's an example for the nbdkit source code
(including the .git directory):

$ time ./nbdkit --filter=partition -U - linuxdisk . partition=1 --run 'qemu-img convert $nbd /var/tmp/ext2fs.img'

real   0m1.314s
user   0m0.424s
sys    0m0.889s

$ ls -lh /var/tmp/ext2fs.img 
-rw-r--r--. 1 rjones rjones 351M Feb 19 07:44 /var/tmp/ext2fs.img

The tests + valgrind pass on Fedora 29 & RHEL 7.


More information about the Libguestfs mailing list