%BOOK_ENTITIES; ]> Virtualization Tools Read this chapter for an introduction to the many tools available to assist with virtualization.
<command>virsh</command> virsh is a command line interface (CLI) tool for managing guests and the hypervisor. The virsh command-line tool is built on the libvirt management API and operates as an alternative to the qemu-kvm command and the graphical virt-manager application. The virsh command can be used in read-only mode by unprivileged users or, with root access, full administration functionality. The virsh command is ideal for scripting virtualization administration. In addition the virsh tool is a main management interface for virsh guest domains and can be used to create, pause, and shut down domains, as well as list current domains. This tool is installed as part of the libvirt-client package. Refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more information about managing virtual machines with virsh.
<command>virt-manager</command> A light-weight graphical tool for managing virtual machines. It provides the ability to control the life cycle of existing machines, provision new machines, manage virtual networks, access the graphical console of virtual machines, and view performance statistics. This tool ships in its own package called virt-manager. Refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more information about managing virtual machines with virt-manager.
<command>virt-install</command> A command line tool to provision new virtual machines. It supports both text-based and graphical installations, using serial console, SDL, SPICE, or VNC client/server pair graphics. Installation media can be local, or exist remotely on an NFS, HTTP, or FTP server. The tool can also be configured to run unattended and kickstart the guest when installation is complete, allowing for easy automation of installation. This tool is installed as part of the python-virtinst package. Refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide for more information about virt-install.
<command>guestfish</command> A command line tool for examining and modifying the file systems of the host. This tool uses libguestfs and exposes all functionality provided by the guestfs API. This tool ships in its own package entitled guestfish. Refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide for more information about guestfish. Using guestfish on running virtual machines can cause disk-image corruption. Use the guestfish command with the (read-only) option if the disk image is being used by a running virtual machine.
Other useful tools The following tools are used to access a virtual machine's disk via the host. The guest's disk is usually accessed directly via the disk-image file located on the host. However it is sometimes possible to gain access via the libvirt domain. 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. This tool is installed as part of the libguestfs-mount package. Using guestmount in read/write mode to access a disk that is currently being used by a guest can cause the disk to become corrupted. Do not use guestmount in read/write mode on live virtual machines. Use the guestmount command with the (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 package Using virt-cat on running virtual machines can cause disk corruption in the virtual machine. Do not use virt-cat command on a running virtual machine. 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 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 package. Using virt-edit on live virtual machines can 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. Therefore, 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 package. 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 package. virt-inspector2 An alternative tool to virt-inspector, written in C. This tool is installed as part of the libguestfs-tools 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 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-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 package. Using virt-rescue on running virtual machines can 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 (read-only) option will not cause disk corruption, but may give strange or inconsistent results. It is better to 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 package. 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-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. Using virt-tar with the (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 (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 stats related to virtualized domains. This tool ships in its own package: virt-top. virt-v2v A graphical tool to convert virtual machines from Xen and VMware hypervisors to run on KVM. This tool ships in its own package: virt-v2v. virt-viewer A minimal tool for displaying the graphical console of a virtual machine via the VNC and SPICE protocols. This tool ships in its own package: virt-viewer. virt-what A shell script that detects whether a program is running in a virtual machine. This tool ships in its own package: virt-what. 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 ships in its own package: virt-who. virt-win-reg A command line tool to export and merge Windows Registry entries from a Windows guest, and perform simple Registry operations. This tool is installed as part of the libguestfs-tools package. 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. 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 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.