How to know if a Linux system is physical or virtual

VPS

Virtualization technologies they have made physical resources much better used. Many hosting or cloud companies use virtualization to obtain benefits that would be difficult to achieve with physical systems or that would be more expensive, in addition to supplying some advantages such as creating VPS (Virtual Private Server) within a physical server to obtain a lot of independent servers to offer clients independent systems that act with total independence, being able to shut down one system without affecting the rest or managing them independently ...

Well, these technologies that provide us with so many benefits have evolved enough to make it difficult to know if we are dealing with a physical system or a virtual system. Obviously if we have created it, it is easy to know ... I did not mean that. But when we access a system remotely, without having too much knowledge about it, it would be impossible for us tosee if it is a virtualized system or is it really a physical system. So in this article we will learn how to know ...

Many administrators manage systems remotely and this can be a problem, so if we have access to systems with Linux, we can easily know if they are virtual or not using various methods that I explain below:

  • Using the dmidecode tool, it is a tool that makes use of DMI or SMBIOS tables that provides information about the manufacturer, serial number, model, and other hardware data of the system. We simply have to execute the command to obtain it if we have this tool installed. For example, we can use the -t option to indicate the type of information to obtain (see the man). Depending on what we obtain from the following command, we can know if it is a virtual or physical system from the manufacturer:
sudo dmidecode -s system-manufacturer

  • We can also use lshw to obtain hardware information and in this case to know the type of system:
sudo lshw -class system

  • It is also possible to use the system logs for this utility:
sudo dmesg | grep "Hypervisor detected"

There are more methods such as the facter utility, scripts, virt-what, etc.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

A comment, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Alberto said

    Thank you very much,

    It has been quite useful in the face of an inventory that I have had to do.

    Greetings.

bool (true)