virt-what - detect if we are running in a virtual machine

virt-what is a shell script which can be used to detect if the program is running in a virtual machine.

The program prints out a list of facts about the virtual machine, derived from heuristics. One fact is printed per line.

# virt-what
xen
xen-domU

If nothing is printed and the script exits with code 0 (no error), then it can mean either that the program is running on bare-metal or the program is running inside a type of virtual machine which we don't know about or cannot detect.

Most of the time, using this program is the wrong thing to do. Instead you should detect the specific features you actually want to use. (As an example, if you wanted to issue Xen hypervisor commands you would look for the /proc/xen/privcmd file).

Download

Source and binaries are available here.

Community, discussions, feedback

virt-what is actively developed by Red Hat and the community. If you have questions, problems, patches or feedback on virt-what then go to the fedora-virt mailing list, or hop over to our IRC channel #virt on OFTC.

Documentation

The virt-what manual page.

Source code repository

Source code is now in git (thanks Jim Meyering).

git clone git://git.annexia.org/git/virt-what.git

rjones AT redhat DOT com

$Id: index.html,v 1.3 2009/11/16 12:53:15 rjones Exp $