第一種方式:dmesg命令
[root@test ~]# dmesg | grep -i hypervisor
[ 0.000000] Hypervisor detected: VMware
[ 0.001000] TSC freq read from hypervisor : 2903.999 MHz
[ 6.311621] [drm] Max dedicated hypervisor surface memory is 0 kiB
第二種方式:lscpu命令
如果lscpu
命令輸出中出現(xiàn)Hypervisor vendor: KVM
則表示是虛擬機,而出現(xiàn)Virtualization: VT-x
則表示是實體機。
[root@test ~]# lscpu | grep Hypervisor
[root@test ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
座: 2
NUMA 節(jié)點: 1
廠商 ID: GenuineIntel
CPU 系列: 6
型號: 165
型號名稱: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
步進: 5
CPU MHz: 2903.999
BogoMIPS: 5807.99
超管理器廠商: VMware
虛擬化類型: 完全
L1d 緩存: 32K
L1i 緩存: 32K
L2 緩存: 256K
L3 緩存: 16384K
NUMA 節(jié)點0 CPU: 0-3
虛擬化技術有兩種類型的實現(xiàn):
- Type-I : hypervisor -> VM
- Type-II:host -> VM -> VMS
第三種方式:systemd-detect-virt命令
[root@test ~]# systemd-detect-virt
vmware
第四種方式:dmidecode命令
[root@test ~]# dmidecode -t 1
# dmidecode 2.12
SMBIOS 2.7 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Version: None
Serial Number: VMware-56 4d 2a a5 0b e5 cb 1c-04 3e 84 3e da c3 3c 4c
UUID: A52A4D56-E50B-1CCB-043E-843EDAC33C4C
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified
常見的云主機輸出結果
文章來源:http://www.zghlxwxcb.cn/news/detail-680518.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-680518.html
到了這里,關于Linux查看是虛擬機還是物理機的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!