$plugindir/nbdkit-guestfs-plugin.so
The plugin.
Use "nbdkit --dump-config" to find the location of $plugindir.
Nbdkit libguestfs plugin
nbdkit {[-r]
guestfs
[disk=DISK]
[domain=DOMAIN]
[format=FORMAT]
[connect=URI]
[{mount=inspect | MOUNT}]
[trace=on]
[debug=on]
export=DEVICE | FILE}
Using nbdkit-guestfs-plugin in read-write mode on live virtual machines can be dangerous, potentially causing disk corruption. Use the -r (read-only) option to use this plugin safely if the disk image or virtual machine might be live.
Export the first partition inside a disk image called "disk.img", and allow writes:
nbdkit guestfs disk=disk.img export=/dev/sda1
Export a disk image which is located inside a libvirt guest called "Guest", read-only (-r option):
nbdkit -r guestfs domain=Guest mount=inspect export=/images/disk.img
"nbdkit-guestfs-plugin" is an nbdkit(1) plugin that lets you access the contents of disk images over NBD. There are many weird and wonderful uses for this, and this man page only covers the simpler ones.
The parameters control:
Which disk(s) are added to libguestfs. Specifically "disk=DISK" and "domain=DOMAIN" add a single disk or all the disks from a particular libvirt guest.
What, if any, filesystems inside the disk image / guest have to be mounted. Use "mount=inspect" to do this automatically (like guestfish(1) -i option), else mount individual filesystems.
What device or file from inside the disk image or guest you want to export over NBD. Use "export=DEVICE|FILE" to specify the thing that you want to export.
Use the -r option to export read-only. The default is read-write.
connect=URIThis optional parameter specifies the libvirt connection URI. This is only used with the "domain" parameter.
debug=onEnable full debugging of libguestfs. Note you'll probably also have to use the nbdkit(1) option -v in order to see the messages.
disk=DISKAdd the named disk image. You may specify this option multiple times.
domain=DOMAINAdd the disk(s) from the libvirt guest called "DOMAIN".
export=DEVICEexport=FILEExport "DEVICE" or "FILE" (from inside the disk image or guest) over NBD.
Device names are the usual libguestfs names like /dev/sda1 (meaning the first partition of the first disk), or /dev/VG/LV (a logical volume), or RAID arrays etc. The device name should not be confused with host devices.
Filenames are similarly those located inside the guest or disk image, and always start with a "/" character (even for Windows guests).
Exports are writable by default. Use the -r option to make them read-only. Exporting read-write a live disk image or virtual machine will probably cause disk corruption.
format=FORMATThis can be used to specify the format of the disk. Use it before the "disk=DISK" argument. It works like the --format option of guestfish(1).
mount=inspectUse guest inspection to mount disks. This is like "guestfish -i".
mount=DEVmount=DEV:MOUNTPOINTMount "DEV" from inside the guest on "MOUNTPOINT" (defaults to /). This is like "guestfish -m".
trace=onEnable tracing of libguestfs calls. Note you'll probably also have to use the nbdkit(1) option -v in order to see the messages.
disk.img is a host file that contains partitions or LVM logical volumes. Use the "disk=disk.img" option to add the disk. Because you don't want to access filesystem contents, "mount=..." is not needed.
nbdkit guestfs disk=disk.img export=/dev/sda1
nbdkit guestfs disk=disk.img export=/dev/VG/LV
Use virt-filesystems(1) to find out what devices, partitions, LVs, filesystems etc a disk image contains.
Guest is the name (in libvirt) of a guest. Since the guest might be live, we use the -r option to open the guest read-only. Because you don't want to access filesystem contents, "mount=..." is not needed.
nbdkit -r guestfs domain=Guest export=/dev/sda1
nbdkit -r guestfs domain=Guest export=/dev/VG/LV
disk.img is a partitioned disk image with one filesystem that contains a file that we want to export. Use the "disk=disk.img" option to add the disk, and "mount=/dev/sda1" to specify the filesystem in the disk image. Use "export=/image" to specify the name of the file in that filesystem that we want to export.
nbdkit guestfs disk=disk.img mount=/dev/sda1 export=/image
windows.img is the disk from a Windows virtual machine. Use the "disk=windows.img" option to add the disk, and "mount=inspect" to auto-mount the filesystem(s) in the disk image. Use "export=/Users/rich/AppData/image" to specify the name of the file from the guest that we want to export.
nbdkit guestfs disk=windows.img mount=inspect \export=/Users/rich/AppData/image
To debug this plugin, use the following options:
nbdkit -f -v guestfs debug=on trace=on [...]
This enables libguestfs debugging and tracing (see guestfs-faq(1)). It also ensures that the messages are displayed by nbdkit (because of -f and -v).
$plugindir/nbdkit-guestfs-plugin.so
The plugin.
Use "nbdkit --dump-config" to find the location of $plugindir.
"nbdkit-guestfs-plugin" first appeared in nbdkit 1.2.
6 releases since Debian 8 (Jessie); the text changed 5 times.