Determining whether a Linux system is running on a physical machine or a virtualized environment is a crucial diagnostic task, providing valuable insights into the system's infrastructure and aiding in system administration. In a rapidly evolving technological landscape, where virtualization has become ubiquitous for its flexibility, resource optimization, and scalability, being able to distinguish between a physical host and a virtual machine is fundamental for effective management, troubleshooting, and resource allocation. This tutorial provides 2 methods how to check if a Linux system is physical or virtual machine.
Method 1 - dmidecode manufacturer
dmidecode is a command line tool that provides information about the system's hardware, including details about the motherboard, BIOS, and other hardware components. This tool can provide virtualization-related information for identifying if the system is a virtual machine.
Run the following command to get system manufacturer:
sudo dmidecode -s system-manufacturer
If it is a virtual machine, the output will typically display names such as "VMware, Inc", "innotek Gmbh" (for VirtualBox), "QEMU", or other manufacturer name that indicate the use of a virtualization platform.
If it is a physical system, the output may show the name of the manufacturer, such as Micro-Star International, Dell, Lenovo, HP, or others.
Method 1 - dmidecode product name
Execute the following command to get system product name, which often provides insights into the hardware or virtualization platform the Linux system is running on:
sudo dmidecode -s system-product-name
If the output indicates a well-known virtualization platform like VMware, VirtualBox, Standard PC (for QEMU), it's a virtual machine.
If it's a physical system, the output might display a product line name like Inspiron, ThinkPad, ProBook, etc. It may also specify motherboard code like MS-7D86.