There are several ways to check if the server is a physical server or virtual server. Post list just two such methods.
1. Using dmidecode
Among many information listed by the dmidecode command (requires root access) one is the system-manufacturer string. If this is a physical server the command will output the vendor name, if not it will output the virtual software name.
On physical servers
There are other strings in the demidecode output that could also be used to find out which the server is physical or virtual.
Grep on Product on physical servers returns
2. Using virt-what
virt-what (included in virt-what-*.rpm, comes with RedHat and other distros) checks if the running system is a physical or virtual. This command must be run as root user.
On physical servers the command does not return anything and goes back to prompt.
1. Using dmidecode
Among many information listed by the dmidecode command (requires root access) one is the system-manufacturer string. If this is a physical server the command will output the vendor name, if not it will output the virtual software name.
On physical servers
# dmidecode -s system-manufacturerOn Virtual servers
Dell Inc.
# dmidecode -s system-manufacturer
IBM
The innotek GmbH is from a VM server created with VirtualBox
# dmidecode -s system-manufacturer
VMware, Inc.
# dmidecode -s system-manufacturer
innotek GmbH
There are other strings in the demidecode output that could also be used to find out which the server is physical or virtual.
Grep on Product on physical servers returns
# dmidecode | grep ProductOn virtual servers return
Product Name: PowerEdge M610
Product Name: 02Y41P
Product Name:
# dmidecode | grep Product
Product Name: IBM System x3550 M4 Server -[7914ZT7]-
Product Name: 00J6242
# dmidecode | grep ProductIt's also possible to grep on the string Virtual. Output from physical servers.
Product Name: VMware Virtual Platform
Product Name: 440BX Desktop Reference Platform
# dmidecode | grep Product
Product Name: VirtualBox
Product Name: VirtualBox
# dmidecode | grep VirtualOutput from virtual servers
VME (Virtual mode extension)
# dmidecode | grep Virtual
VME (Virtual mode extension)
Enhanced Virtualization
# dmidecode | grep Virtual
Product Name: VMware Virtual Platform
VME (Virtual mode extension)
VME (Virtual mode extension)
VME (Virtual mode extension)
VME (Virtual mode extension)
String 2: Welcome to the Virtual Machine
# dmidecode | grep Virtual
Version: VirtualBox
Product Name: VirtualBox
Family: Virtual Machine
Product Name: VirtualBox
2. Using virt-what
virt-what (included in virt-what-*.rpm, comes with RedHat and other distros) checks if the running system is a physical or virtual. This command must be run as root user.
On physical servers the command does not return anything and goes back to prompt.
[root@srv6 ~]# virt-whatOn virtual servers
[root@srv6 ~]#
# virt-what
vmware
# virt-what
virtualbox