virt-what
is a shell script which can be used to detect
if the program is running in a virtual machine.
virt-what
supports a very large number of different
hypervisor types, including common open source hypervisors (KVM, Xen,
QEMU, VirtualBox), mainframe systems like IBM
Systemz, LPAR, z/VM, hardware partitioning schemes
like Hitachi Virtage, proprietary hypervisors like
VMWare, Microsoft Hyper-V
and much more.
virt-what
is already packaged
in Fedora (13+), Red Hat Enterprise
Linux (5.7+ and
6.1+), Debian, Ubuntu, ArchLinux
and Gentoo, and it can be compiled from
source on just about any Linux.
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 |
# virt-what kvm |
# virt-what (nothing printed ⇒ baremetal) |
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).
Source tarballs are available here.
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 virt-tools
mailing list, or hop over to our IRC
channel #virt on OFTC.
Source code is now in git (thanks Jim Meyering).
git clone git://git.annexia.org/virt-what.git
$Id: index.html,v 1.6 2011/02/01 19:15:58 rjones Exp $