16.4. The guestfish Shell
guestfish --ro -a /path/to/disk/image
libguestfsto edit a live guest virtual machine, and attempting to will result in irreversible disk corruption.
guestfish --ro -a /path/to/disk/image Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell ><fs>
16.4.1. Viewing File Systems with guestfish
184.108.40.206. Manual Listing and Viewing
list-filesystemscommand will list file systems found by libguestfs. This output shows a Red Hat Enterprise Linux 4 disk image:
><fs> run ><fs> list-filesystems /dev/vda1: ext3 /dev/VolGroup00/LogVol00: ext3 /dev/VolGroup00/LogVol01: swap
><fs> run ><fs> list-filesystems /dev/vda1: ntfs /dev/vda2: ntfs
file. You can get more information and help on any command by typing
helpcommand, as shown in the following output:
><fs> help vfs-type NAME vfs-type - get the Linux VFS type corresponding to a mounted device SYNOPSIS vfs-type device DESCRIPTION This command gets the file system type corresponding to the file system on "device". For most file systems, the result is the name of the Linux VFS module which would be used to mount this file system if you mounted it without specifying the file system type. For example a string such as "ext3" or "ntfs".
/dev/vda2), which in this case is known to correspond to the C:\ drive:
><fs> mount-ro /dev/vda2 / ><fs> ll / total 1834753 drwxrwxrwx 1 root root 4096 Nov 1 11:40 . drwxr-xr-x 21 root root 4096 Nov 16 21:45 .. lrwxrwxrwx 2 root root 60 Jul 14 2009 Documents and Settings drwxrwxrwx 1 root root 4096 Nov 15 18:00 Program Files drwxrwxrwx 1 root root 4096 Sep 19 10:34 Users drwxrwxrwx 1 root root 16384 Sep 19 10:34 Windows
tar-outto view and download files and directories.
cdcommand to change directories. All paths must be fully qualified starting at the top with a forward slash (/) character. Use the Tab key to complete paths.
220.127.116.11. Using guestfish inspection
guestfish --ro -a /path/to/disk/image -i Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Red Hat Enterprise Linux AS release 4 (Nahant Update 8) /dev/VolGroup00/LogVol00 mounted on / /dev/vda1 mounted on /boot ><fs> ll / total 210 drwxr-xr-x. 24 root root 4096 Oct 28 09:09 . drwxr-xr-x 21 root root 4096 Nov 17 15:10 .. drwxr-xr-x. 2 root root 4096 Oct 27 22:37 bin drwxr-xr-x. 4 root root 1024 Oct 27 21:52 boot drwxr-xr-x. 4 root root 4096 Oct 27 21:21 dev drwxr-xr-x. 86 root root 12288 Oct 28 09:09 etc [etc]
runcommand is not necessary when using the
-ioption works for many common Linux and Windows guest virtual machines.
18.104.22.168. Accessing a guest virtual machine by name
virsh list --all). Use the
-doption to access a guest virtual machine by its name, with or without the
guestfish --ro -d GuestName -i