其他分享
首页 > 其他分享> > 判断我们的服务器是物理机还是虚拟机

判断我们的服务器是物理机还是虚拟机

作者:互联网

方法一:dmesg

举例如下:

###这是阿里云的云主机
[root@xxx ~]# dmesg |grep -i virtual
[    0.000000] Booting paravirtualized kernel on KVM
[    0.707486] KVM setup paravirtual spinlock
[    1.811087] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input2
[    1.811257] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input3
[    1.824106] systemd[1]: Detected virtualization kvm.
[    1.853583] systemd[1]: Starting Setup Virtual Console...
###这是一台物理机
[root@xxx]# dmesg |grep -i virtual
Booting paravirtualized kernel on bare hardware
input: Macintosh mouse button emulation as /devices/virtual/input/input1

 

方法二:dmidecode 

举例如下:

###这是阿里云的云主机
[root@xxx~]# dmidecode -s system-product-name
Alibaba Cloud ECS
###这是一台物理机
[root@xxx]# dmidecode -s system-product-name
PowerEdge R720

标签:虚拟机,xxx,virtual,dmidecode,input,服务器,root,###,物理
来源: https://www.cnblogs.com/--smile/p/11810227.html