linux查看是实体机还是虚拟机
1、判断虚拟机三种方式
1、dmesg|grep -i hypervisor
[root@localhost ~]# dmesg|grep -i hypervisor [ 0.000000] Hypervisor detected: VMware
2、lscpu 查看Hypervisor vendor:超管理器厂商
[root@k8s-master ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 4 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 79 Model name: Intel(R) Xeon(R) CPU E5-4610 v4 @ 1.80GHz Stepping: 1 CPU MHz: 1795.841 BogoMIPS: 3591.68 Hypervisor vendor: VMware #虚拟机 Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 25600K NUMA node0 CPU(s): 0-7
Hypervisor vendor: KVM #虚拟机
Virtualization: VT-x #实体机
KVM:
虚拟化技术有两种类型的实现:
Type-I : hypervisor------>VM
Type-II:host------>VM----->VMS
3、systemd-detect-virt
#虚拟机 [root@localhost ~]# systemd-detect-virt vmware #实体机 [root@master242 ~]# systemd-detect-virt none
做一个决定,并不难,难的是付诸行动,并且坚持到底。