How to judge whether a machine is a physical machine or a virtual machine

Linux server:


[root@manage ~]# dmidecode -s system-product-name
Alibaba Cloud ECS

[root@manage ~]# lshw -class system
manage.ansible.com          
    description: Computer
    product: Alibaba Cloud ECS
    vendor: Alibaba Cloud
    version: pc-i440fx-2.1
    serial: ca717e64-75b1-45a1-b89f-004d6eb63ec0
    width: 64 bits
    capabilities: smbios-2.8 dmi-2.8 smp vsyscall32
    configuration: boot=normal uuid=647E71CA-B175-A145-B89F-004D6EB63EC0
  *-pnp00:00
       product: PnP device PNP0b00
       physical id: 1
       capabilities: pnp
       configuration: driver=rtc_cmos

[root@manage ~]# dmesg | grep -i virtual
[    0.000000] Booting paravirtualized kernel on KVM
[    0.072025] KVM setup paravirtual spinlock
[    1.195196] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input2
[    1.195515] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input3
[    1.249767] systemd[1]: Detected virtualization kvm.
[    1.346833] systemd[1]: Starting Setup Virtual Console...

Windows server:

Enter in CMD: Systeminfo | findstr / i "System Model"
If System Model: Virutal behind is a virtual machine, the other is a physical machine
How to judge whether a machine is a physical machine or a virtual machine
If you use the powershell command: get-wmiobject win32_computersystem | fl model
How to judge whether a machine is a physical machine or a virtual machine

Guess you like

Origin blog.51cto.com/molewan/2487364