[CentOS] How to detect whether running on VMware?

Thu Jul 24 12:08:38 UTC 2008
Marc-Andre Levesque <marc-andre.levesque at genizon.com>


-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Tony Mountifield
>Does anyone know how a program, script or shell user can best determine
>whether the machine is running on bare metal or is a VMware guest?
>
>Cheers
>Tony

This script does the trick for me on ESX 3 by looking at the (virtual) hardware description. But it probably is not foolproof.

if ( `/sbin/lspci | grep -qi vmware` ) || \
   ( `grep -qi vmware /proc/scsi/scsi` ); then
    echo "This is a Virtual Machine."
Fi

Marc-Andre