判斷咱們的服務器是物理機仍是虛擬機

忽然有一天,有人問,這臺設備是物理機仍是虛擬機,我就懵逼了。ide

很簡單,這裏寫一下,之後查起來方便。阿里雲

方法一:dmesg

舉例以下:spa

###這是阿里雲的雲主機 [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 

舉例以下:code

###這是阿里雲的雲主機 [root@xxx~]# dmidecode -s system-product-name Alibaba Cloud ECS
###這是一臺物理機 [root@xxx]# dmidecode -s system-product-name PowerEdge R720
相關文章
相關標籤/搜索