How to check if Linux server is physical or VM or cloud

Recently one of my friend came across situation where he didnt know logged in server is physical server, virtual machine or cloud server. So here in this article we will walk you through how to check if server is physical serve or virtual machine. Since cloud servers are also VM there is very thin line between identifying them as different. It takes some infrastructure knowledge and sense to differentiate between VM and cloud hosted server.
dmidecode command helps you through this process. This command helps you to identify manufacturer of system. Lets look at its output :
This is output from AWS server In above output you have to observe ‘System Information‘ section.

Manufacturer :
If you see Xen, vmware, Red Hat etc here its a VM (virtual machine). VM host KVM also shows same manufacturers. Anything other than these like Dell Inc, HP etc (hardware manufacturing companies name) shows that you are on real physical hardware means its physical server.
Product Name :
This parameter also helps further to confirm its physical or VM. Here HVM denotes its virtual machine clearly. For a physical server you see physical server model name here.
Version :
Its again narrowing down your search. Word amazon here denotes its a VM from Amazon (most likely AWS). So as I said if you know your infrastructure well, so must be knowing you have AWS servers or not. And hence you can be sure here that its AWS cloud server.
Even serial number can be a confirmation but you should have in depth knowledge of hardware serial number nomenclature used by industry manufacturers. Mostly, physical hardware has much short, clean and human readable serial number whereas VM has long serial which starts with virtual service name (eg, ec2 for AWS cloud, VMWare for vmware vm etc.) This can be added confirmation and not primary parameter for validation.
For more understanding lets look at output from virtual machine :
In above output,
Manufacturer is VMware Inc. which denotes its a VM
Product Name VMware Virtual Platform clearly states its VM
Like cloud server above we do not have version value here. But above two values are sufficient to confirm its a VM. These values put up by hardware or system image manufacturer hence can be blank at times.
Finally, before signing off lets check output from physical machine as well –
Here,
Manufacturer is Cisco System Inc (who is hardware manufacturer) confirming its server hosted on bare metal.
Product Name is a UCSB-B200-M3 which is model name of Cisco Blade. Confirms server is Cisco Blade hardware (Physical server)

Checks submitted by readers

Few readers posted these commands on social media posts comments.
lscpu : One can observe hypervisor vendor to determine if its virtual or physical server
hostnamectl : Works on new distro like RHEL7. Virtualization field gives you idea about if its physical or virtual.
dmesg : Check for words like kvm, hvm or virtual in boot messages. Here Xen virtualization detected confirming its a virtual box.

Conclusion

System information like manufacturer, product name, version, serial number can be used to observe and understand whether logged in server is physical server or VM (physical hosted or cloud).
If you have any other tricks or solid methods to confirm server is physical or virtualised, please let us know in comments below.
SHARE

sangeethakumar

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment