判断服务器是虚拟机还是物理机方式


一、如果是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

相关文章:

  • 2021-11-29
  • 2021-08-22
  • 2022-12-23
  • 2021-07-27
  • 2022-02-06
  • 2022-12-23
  • 2022-02-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案