Jump to content

libguestfs

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Artoria2e5 (talk | contribs) at 19:32, 19 May 2025. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
libguestfs
Developer(s)Richard Jones
Initial releaseApril 4, 2009; 16 years ago (2009-04-04)[1]
Stable release
1.40 / February 8, 2019; 6 years ago (2019-02-08)[2]
Written inC; utilities in OCaml Perl, et al.
Operating systemLinux
TypeVirtualization
LicenseLGPL, GPL
Websitelibguestfs.org

libguestfs is a C library and a set of tools for accessing and modifying virtual disk images used in platform virtualization. The tools can be used for viewing and editing virtual machines (VMs) managed by libvirt and files inside VMs, scripting changes to VMs, creating VMs, and much else besides.[3] It was created to avoid security issues that occur when virtual disk images are mounted directly on the host system.[4]

libguestfs can access nearly any type of file system including: all known types of Linux filesystem (ext2/3/4, XFS, btrfs, etc.), any Windows filesystem (VFAT and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, Hyper-V VHD/VHDX, on files, local devices, CD and DVD ISOs, SD cards, or remotely over FTP, HTTP, SSH, iSCSI, NBD, GlusterFS, Ceph, Sheepdog, and much more. libguestfs does not require root permissions.

The functionality is available through a shell called guestfish. There is a rescue shell called virt-rescue for fixing unbootable virtual machines. Multiple tools are available modeled after ordinary Unix commands, such as virt-cat and virt-tar.[5]

libguestfs is also an API that can be linked with C and C++ management programs and has bindings for Perl, Python, Ruby, Java, OCaml, PHP, Haskell, Erlang, Lua, Golang and C#. It can be used from shell scripts or in the command line. Using the FUSE module guest filesystems can be mounted on the host with the guestmount command.[6]

libguestfs is implemented using the Kernel-based Virtual Machine for the Linux kernel.[7]

Structure

libguestfs is only one part of the larger libguestfs project. Each of the following is a separate source code archive (tarball):[8]

  • libguestfs, the library.
  • guestfs-tools, the command-line programs making use of libguestfs.
  • hivex, the Windows Registry editing library (with command-line programs).
  • libnbd, userspace library providing a network block device client.
  • nbdkit, code for a network block device server.
  • supermin, tools for create tiny VM-like "appliances".
  • virt-p2v, tool for converting a physical machine into a KVM instance.
  • virt-v2v, tool for converting a non-KVM hypervisor instance into a KVM instance.

Some of these components (nbd-related and hivex) are created separately by libguestfs authors because they are useful in tasks related to libguestfs's purpose, but can be used independently of the image-handling functionality. Others are tools that build on libguestfs but go beyond its original scope.

The libguestfs.org upstream only maintains Python-language bindings. All other bindings are unofficial.

Hivex

Hivex is a C library from the authors, intended for reading and writing Windows Registry Hive files. It comes with a number of console programs for processing these files. Hivex itself does not deal with virtual machine images. For editing files in VM images, libguestfs ships a program called "virt-win-reg".[9]

See also

References

  1. ^ "Historical releases of libguestfs".
  2. ^ "libguestfs 1.40 stable".
  3. ^ "Description from home page".
  4. ^ "A reminder why you should never mount guest disk images on the host OS".
  5. ^ "Features in Fedora 12".
  6. ^ "Description from home page".
  7. ^ "Internal description of libguestfs".
  8. ^ https://download.libguestfs.org/
  9. ^ https://libguestfs.org/hivex.3.html