Most of the time we access and manage servers remotely. We will not always have physical access of our server. As a Linux Administrator, sometimes you need to know whether the machine you’re accessing is physical or virtual if you need to fix anything on system. There are may ways to identify if your system is physical or virtual. Here are some simpler ways to do that:
METHOD 1: Using lshw command
# yum install epel-release
# yum install lshw
# lshw -class system
The output would be like:
[root@test ~]# lshw -class system
test
description: Computer
product: KVM
vendor: Red Hat
version: RHEL 6.6.0 PC
width: 64 bits
(This is the result from virtual machine)
OR
[root@dedi ~]# lshw -class system
dedi
description: Rack Mount Chassis
product: ProLiant DL320e Gen8 (675597-B21)
vendor: HP
serial: CZ33098S20
width: 64 bits
(This is the result from Physical Machine)
METHOD 2: Using virt-what
# yum install virt-what
# virt-what
The output would be:
[root@test ~]# virt-what
kvm
NOTE: If there is no result after running this command, the machine is physical.