VMware Linux Server -- how can you tell if you are a vm or real hardware?

An interesting question. I have logged into a Linux (most likely SuSE) host. Is there some way that I can tell programmatically that I am a VM host or not?

Also assume that the vmtools are not installed.


Use standard Linux tools to inspect the hardware on the system.

cat /proc/scsi/scsi

or

ethtool -i eth0

or

dmidecode | grep -i vmware

If the output of these commands shows hardware with a manufacturer name of "VMWare", you're on a VMWare VM. Multiple commands are provided here because system configurations and tools differ.


facter virtual 
xenu

indicates that it’s a VM. If it returned “physical” then the opposite is true (not a VM), eg:

facter virtual
Physical

You might be able to get and idea by looking around under /sys. For example /sys/class/dmi/id/sys_vendor has a value of VMware, Inc..

If it is installed you can use lshw. The command lshw -class system returns this on my system:

server1
    description: Computer
    product: VMware Virtual Platform
    vendor: VMware, Inc.
    version: None
    serial: VMware-...
    width: 64 bits
    capabilities: smbios-2.4 dmi-2.4 vsyscall64 vsyscall32

There is a handy app that might help called virt-what. I haven't used it with VMWare, but it did work nicely with Qemu.