判断服务器是虚拟机还是物理机方式
一、如果是Linux:
1、在bash里输入:dmidecode -s system-product-name
或者lshw -class system
或者dmesg | grep -i virtual
如果结果返回包含virtual,则是虚拟机:
[root@centos7xj ~]# dmesg |grep -i virtual
[ 0.000000] Booting paravirtualized kernel on Xen HVM
[ 1.034572] systemd[1]: Detected virtualization xen.
[ 1.065757] systemd[1]: Starting Setup Virtual Console...
[ 1.287144] xen_netfront: Initialising Xen virtual ethernet driver
如果返回如下,基于hardware,则说明是物理机:
[root@centos7xj ~]# dmesg|grep -i virtual
Booting paravirtualized kernel on bare hardware
input: Macintosh mouse button emulation as /devices/virtual/input/input2