Today we released the first proper version of virt-inspector, which is a command line tool that tells you what’s in a virtual machine. You just point it at a disk image or a libvirt domain and it can tell you things like:
- What operating system(s) are installed, and what distros and versions.
- How disk partitions are expected to be mounted (eg. /dev/sda1 -> /boot)
- What applications are installed.
- What kernel(s) are installed.
- What kernel modules are installed.
The report that comes out can be in plain text or in XML so you can feed it to another program. You can also use it as a wrapper around guestfish, to pre-mount the filesystems as they would be mounted on the virtual machine:
$ eval `virt-inspector --fish /dev/Guests/CentOS5.img` Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help with commands 'quit' to quit the shell ><fs> mounts /dev/mapper/VolGroup00-LogVol00 /dev/sda1 ><fs> ll /boot/ total 12151 drwxr-xr-x 4 root root 1024 May 11 18:16 . drwxr-xr-x 22 root root 4096 May 19 05:06 .. -rw-r--r-- 1 root root 931546 May 7 11:05 System.map-2.6.18-128.1.10.el5 -rw-r--r-- 1 root root 931457 Jan 21 11:10 System.map-2.6.18-128.el5 -rw-r--r-- 1 root root 67942 May 7 11:05 config-2.6.18-128.1.10.el5 -rw-r--r-- 1 root root 67937 Jan 21 11:10 config-2.6.18-128.el5 [etc]