nbdkit-guestfs-plugin(1) | NBDKIT | nbdkit-guestfs-plugin(1) |
nbdkit-guestfs-plugin - 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:
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.
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).
Use "nbdkit --dump-config" to find the location of $plugindir.
"nbdkit-guestfs-plugin" first appeared in nbdkit 1.2.
nbdkit(1), nbdkit-plugin(3), guestfish(1), guestfs(3), virt-filesystems(1), http://libguestfs.org.
Richard W.M. Jones
Copyright (C) 2013 Red Hat Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2021-01-20 | nbdkit-1.24.1 |