用 dmidecode 判断主机是物理机还是虚拟机

排查环境时经常需要确认一台机器跑在物理硬件上还是虚拟化平台上。用 dmidecode -s system-product-name 看一眼产品名,基本就能判断。

物理机示例:

1
2
[root@pearl-cw01 ~]# dmidecode -s system-product-name
ProLiant BL460c Gen9

OpenStack 虚拟机示例:

1
2
[root@vm-10-75-112-151 ~]# dmidecode -s system-product-name
OpenStack Compute

物理机返回具体型号,虚拟机通常返回 hypervisor 或云平台标识。

Notice: 正常情况下,这里会有一个基于utteranc.es的留言系统,如果看不到,可能要想想办法才能看到。

Powered by Hexo and Hexo-theme-hiker

Copyright © 2012 - 2026 tiaobug.com All Rights Reserved.

鲁ICP备2024124237号-1