From a Linux OS, is there a way to determine if the OS is running as a guest OS on a virtualized VMware environment as opposed to running directly on non-virtualized/bare metal/physical host? In my case it is either VMware or not, but I am also interested the more general question of whether the OS is on physical hardware or virtualized hardware of any sort.
3 Answers
In VMware:
# dmidecode --string system-product-name
VMware Virtual Platform
In Virtualbox same command outputs VirtualBox
On newer systems, the command "lscpu" give's you the information you need, inclusive which hypervisor the VM is running on.
-
This seems to work for newer versions showing the "Hypervisor vendor:" entry when a hypervisor is present, but doesn't work for older versions that don't have lscpu such as RHEL 5. Aug 15, 2017 at 15:11
You can look at the output of the following:
- virt-what
- cat /proc/cpuinfo
- dmidecode
- lspci
- lshw
- hwinfo
Any of these will print various things that should point to if and what virtualisation-platform is being used.