5.5. Other Useful Tools The following tools are used to access a guest virtual machine's disk from the host. The guest's disk is usually accessed directly using the disk-image file located on the host. The commands that follow are part of the libvirt domain and are used to gain access to the guest's disk image. guestmount A command-line tool used to mount virtual machine file systems and disk images on the host machine. Warning Using guestmount in --r/w (read/write) mode to access a disk that is currently being used by a guest may cause the disk to become corrupted. Do not use guestmount in --r/w (read/write) mode on live virtual machines. Use the guestmount command with the --ro (read-only) option if the disk image is being used. virt-cat A command-line tool that can be used to quickly view the contents of one or more files in a specified virtual machine's disk or disk image. This tool is installed as part of the libguestfs-tools-c package. virt-df A command-line tool used to show the actual physical disk usage of virtual machines, similar to the command-line tool df . Note that this tool does not work across remote connections. It is installed as part of the libguestfs-tools-c package. virt-edit A command-line tool used to edit files that exist on a specified virtual machine. This tool is installed as part of the libguestfs-tools-c package. Warning Using virt-edit on live virtual machines may cause disk corruption in the virtual machine. Although the virt-edit command will try to prevent users from editing files on live virtual machines, it is not guaranteed to catch all instances. Do not use virt-edit on a live virtual machine. virt-filesystems A command-line tool used to discover file systems, partitions, logical volumes and their sizes in a disk image or virtual machine. One common use is in shell scripts, to iterate over all file systems in a disk image. This tool is installed as part of the libguestfs-tools-c package. Note This tool replaces virt-list-filesystems and virt-list-partitions . virt-inspector A command-line tool that can examine a virtual machine or disk image to determine the version of its operating system and other information. It can also produce XML output, which can be piped into other programs. Note that virt-inspector can only inspect one domain at a time. This tool is installed as part of the libguestfs-tools-c package. virt-inspector2 An alternative tool to virt-inspector , written in C. This tool is installed as part of the libguestfs-tools-c package. virt-ls A command-line tool that lists files and directories inside a virtual machine. This tool is installed as part of the libguestfs-tools-c package. virt-make-fs A command-line tool for creating a file system based on a tar archive or files in a directory. It is similar to tools like mkisofs and mksquashfs , but it can create common file system types such as ext2, ext3 and NTFS, and the size of the file system created can be equal to or greater than the size of the files it is based on. This tool is provided as part of the libguestfs-tools package. virt-p2v A graphical tool to convert physical machines into virtual machines. This tool is installed as part of the virt-v2v package in Red Hat Enterprise Linux 6.2 and later. virt-rescue A command-line tool that provides a rescue shell and some simple recovery tools for unbootable virtual machines and disk images. It can be run on any virtual machine known to libvirt , or directly on disk images. This tool is installed as part of the libguestfs-tools-c package. Warning Using virt-rescue on running virtual machines may cause disk corruption in the virtual machine. virt-rescue attempts to prevent its own use on running virtual machines, but cannot catch all cases. Using the command with the --ro (read-only) option will not cause disk corruption, but may give strange or inconsistent results. Avoid using virt-rescue on a running virtual machine. virt-resize A command-line tool to resize virtual machine disks, and resize or delete any partitions on a virtual machine disk. It works by copying the guest image and leaving the original disk image untouched. This tool is installed as part of the libguestfs-tools-c package. Important Using virt-resize on running virtual machines can give inconsistent results. It is best to shut down virtual machines before attempting to resize them. virt-sysprep A command-line tool to reset, customize, or unconfigure virtual machines to prepare a template for creating clones. This tool is installed as part of the libguestfs-tools-c package. Important Virtual machines must be shut down before running virt-sysprep . To preserve a virtual machine's existing contents, snapshot, copy or clone the disk before running virt-sysprep . virt-tar A command-line archive tool for downloading and uploading parts of a virtual machine's file system. This tool is commonly used for making backups, uploading data, reviewing guest activity, and fixing or customizing guests. This tool is installed as part of the libguestfs-tools package. Warning Using virt-tar with the -u (upload) option on running virtual machines can cause disk corruption in the virtual machine. virt-tar attempts to prevent its own use on running virtual machines, but cannot catch all cases. Using virt-tar with the -x (extract) option on running virtual machines will not cause disk corruption, but may give strange or inconsistent results. It is best to shut down virtual machines before attempting to extract files from them. virt-top A command-line utility similar to top , which shows statistics related to virtualized domains. This tool is provided by the virt-top package. virt-v2v A graphical tool to convert virtual machines from Xen and VMware hypervisors to run on KVM. This tool is provided by the virt-v2v package. virt-viewer A lightweight utility for displaying the graphical console of a virtual machine using the VNC and SPICE protocols. This tool is provided by the virt-viewer package. virt-what A shell script that detects whether a program is running in a virtual machine. This tool is provided by virt-what package. virt-who The virt-who package is a Red Hat Enterprise Linux host agent that queries libvirt for guest UUIDs. It then passes that data to the local entitlement server for the purposes of issuing certificates. This tool is provided by the virt-who package. Note For further information on using virt-who , see the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide . virt-win-reg A command-line tool to export and merge Windows Registry entries from a Windows virtual machine, and perform simple Registry operations. This tool is installed as part of the libguestfs-tools package. Warning Using virt-win-reg on running virtual machines will cause irreversible disk corruption in the virtual machine. virt-win-reg attempts to prevent its own use on running virtual machines, but cannot catch all cases. Warning Modifying the Windows Registry is an inherently risky operation, as the format is deliberately obscure and undocumented. Changes to the registry can leave the system unbootable, so ensure you have a reliable backup before you use the --merge option. virt-xml-validate A command-line tool to validate libvirt XML files for compliance with the published schema. This tool is installed as part of the libvirt-client package.

Commands: