VM 인지 확인하는 명령어

리눅스/OS 일반|2016. 9. 26. 10:39
반응형
리눅스 자신이 VM인지 아닌지 확인
리눅스 VM 하이퍼바이저 확인
Guest OS 여부 확인

방법 1: virt-what[편집]

16px-Crystal_Clear_app_xmag.svg.png 리눅스 virt-what 문서를 참고하십시오.
[root@zetawiki ~]# virt-what 
kvm
[root@zetawiki ~]# virt-what 
vmware
[root@zetawiki ~]# virt-what
xen
xen-domU

방법 2: lscpu[편집]

[root@zetawiki ~]# lscpu | grep Hypervisor
Hypervisor vendor:     KVM
[root@zetawiki02 ~]# lscpu | grep Hypervisor
Hypervisor vendor:     Xen

방법 3: dmidecode[편집]

16px-Crystal_Clear_app_xmag.svg.png 리눅스 dmidecode 문서를 참고하십시오.
dmidecode | head -5
dmidecode -s system-product-name
실행예시 (Xen VM)
[root@zetawiki ~]# dmidecode | head -5
/dev/mem: mmap: Bad address
# dmidecode 2.10
[root@zetawiki ~]# dmidecode | head -5
# dmidecode 2.11
# No SMBIOS nor DMI entry point found, sorry.
실행예시 (KVM)
[root@zetawiki ~]# dmidecode -s system-product-name
KVM
실행예시 (VMware VM)
[root@zetawiki ~]# dmidecode | head -5
# dmidecode 2.11
SMBIOS 2.4 present.
364 structures occupying 14150 bytes.
Table at 0x000E0010.
[root@zetawiki ~]# dmidecode -s system-product-name
VMware Virtual Platform
실행예시 (Dedi)
[root@zetawiki ~]# dmidecode | head -5
# dmidecode 2.10
SMBIOS 2.6 present.
308 structures occupying 8320 bytes.
Table at 0x7F7FD000.
→ 단독서버의 경우
실행예시 (XenServer)
[root@zetawiki ~]# dmidecode | head -5
# dmidecode 2.7
SMBIOS 2.7 present.
127 structures occupying 3808 bytes.
Table at 0xDF7FE000.
→ 하이퍼바이저의 경우

방법 4: ethtool[편집]

KVM
[root@zetawiki ~]# ethtool -i eth0 | grep driver
driver: virtio_net
Xen VM
[root@zetawiki ~]# ethtool -i eth0 | grep driver
driver: netfront
VMware VM
[root@zetawiki ~]# ethtool -i eth0 | grep driver
driver: e1000

방법 5: fdisk[편집]

Xen VM
[root@zetawiki ~]# fdisk -l

Disk /dev/xvda: 31.4 GB, 31457280000 bytes
255 heads, 63 sectors/track, 3824 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14        3824    30611857+  8e  Linux LVM
KVM
[root@zetawiki ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1          13      104391   83  Linux
/dev/vda2              14        5221    41833260   8e  Linux LVM
VMware VM
[root@zetawiki ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          38      305203+  83  Linux
/dev/sda2              39        2353    18595237+  83  Linux
/dev/sda3            2354        2610     2064352+  82  Linux swap / Solaris
→ VM이지만 sda로 나오므로 확인 어려움



[출처] http://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_VM%EC%97%AC%EB%B6%80_%ED%99%95%EC%9D%B8,_%ED%95%98%EC%9D%B4%ED%8D%BC%EB%B0%94%EC%9D%B4%EC%A0%80_%ED%99%95%EC%9D%B8

반응형

댓글()