How to find out at command line if a system is a virtual guest.

There will be times when it will be necessary to check if the system that you are currently SSH'd into is a hardware or virtual based guest. Before it was easy, just issue an 'eject' command and go check yourself which machine has the CD tray open. Before there were no mixed environments, so things were easier. 


There are couple of ways to figure it out.


1. Use the 'dmidecode' utility. The following command will show basic hardware information for the machine:


dmidecode | grep -A 10 "Handle 0x0001"

Output:

Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Version: None
Serial Number: VMware-XX XX XX XX XX XX XX XX XX XX XX
UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified

The key to the answer is the 'Manufacturer' line. Normally, on a physical hardware it should show the name of the manufacturer: Dell, HP, IBM etc. If the system is virtualized, it will display the hypervizor name. 


2. If the system is hosted on VMware server, then an easy but not foolproof method to find out if the guest system is or 'may be' hosted in virtualized environment is to look for guest support tools that may be installed. In case of VMware one should look for vmware-tools:

rpm -qa | grep -i "vm"

Output:

VMwareTools-7300-82663
xorg-x11-drv-vmmouse-12.4.0-2.1
xorg-x11-drv-vmware-10.13.0-2.1


This doesn't necessarily mean that the system is virtualized but can at least hive a hint about that. 







Did you find this article useful and interesting? If so, please consider subscribing to email updates and RSS feed for more articles like this.
Man Versus Technology

0 comments:

Post a Comment