Using -format with no argument switches back to auto-detection for subsequent -a options.įor example: virt-rescue -format=raw -a disk.imgįorces raw format (no auto-detection) for disk.img. Using this forces the disk format for -a options which follow on the command line. The default for the -a option is to auto-detect the format of the disk image. See "ESCAPE KEY" below for further information. e none means there is no escape key, escapes are disabled. To specify the escape key you can use: ^x
Set the escape key to the given key sequence. Domain UUIDs can be used instead of names. d guest -domain guestĪdd all the disks from the named libvirt guest. If you specify guest block devices directly ( -a), then libvirt is not used at all. If omitted, then we connect to the default libvirt hypervisor. If using libvirt, connect to the given URI. See also "guestfs_add_drive_opts" in guestfs(3). Using -blocksize with no argument switches the disk sector size to the default value which is usually 512 bytes. It affects all explicitly added subsequent disks after this parameter. This parameter sets the sector size of the disk image. blocksize=512 -blocksize=4096 -blocksize Pass additional options to the rescue kernel. See "ADDING REMOTE STORAGE" in guestfish(1). To override this and force a particular format use the -format=. The format of the disk image is auto-detected. If the virtual machine has multiple block devices, you must supply all of them with separate -a options. OPTIONS -helpĪdd FILE which should be a disk image from a virtual machine. To get a structured shell that you can use to make scripted changes to guests, use guestfish(1). For more structured access to a virtual machine disk image, you should use guestfs(3). This tool is just designed for quick interactive hacking on a virtual machine. You only need to run it as root if you need root to open the disk image. This is useful for testing out Linux utilities (see -scratch). You can get virt-rescue to give you scratch disk(s) to play with. You can even use virt-rescue on things like USB drives, SD cards and hard disks. For example you can use it on a blank file if you want to partition that file (although we would recommend using guestfish(1) instead as it is more suitable for this purpose). Virt-rescue can be used on any disk image file or device, not just a virtual machine. To run commands in a Linux guest (for example, grub), you should chroot into the /sysroot directory first: > chroot /sysroot NOTES LV VG Attr LSize Origin Snap% Move Log Copy% ConvertĪnother command to list available filesystems is virt-filesystems(1). You can also mount filesystems individually using the -m option.Īnother way is to list the logical volumes (with lvs(8)) and partitions (with parted(8)) and mount them by hand: > lvs This uses libguestfs inspection to find the filesystems and mount them in the right place. To automatically mount the virtual machine’s filesystems under /sysroot use the -i option.
There is an empty directory called /sysroot where you can mount filesystems. You must mount the virtual machine’s filesystems. What you see in / ( /bin, /lib etc) is the rescue appliance. When you run virt-rescue on a virtual machine or disk image, you are placed in an interactive bash shell where you can use many ordinary Linux commands. You can run virt-rescue on any virtual machine known to libvirt, or directly on disk image(s): virt-rescue -d GuestName -iįor live VMs you must use the -ro option. virt-rescue gives you a rescue shell and some simple recovery tools which you can use to examine or rescue a virtual machine or disk image. Virt-rescue is like a Rescue CD, but for virtual machines, and without the need for a CD. You may see strange or inconsistent results if running concurrently with other changes, but with this option you won't risk disk corruption. Use the -ro (read-only) option to use virt-rescue safely if the disk image or virtual machine might be live. The virtual machine must be shut down before you use this command, and disk images must not be edited concurrently. Using virt-rescue in write mode on live virtual machines, or concurrently with other disk editing tools, can be dangerous, potentially causing disk corruption.
Virt-rescue - Run a rescue shell on a virtual machine SYNOPSIS virt-rescue -d domname