메뉴 닫기

물리적인 서버 / 가상서버 확인방법

관리해야할 서버가 늘어나면서 서버목록을 정리해 두기위한 물리서버/가상서버를 명령어만으로 확인할수 있는 방법 몇가지 소개하며 명령어로 하드웨어 플래그를 정의한 값들을 정리해봅니다.

테스트환경
https://www.iwinv.kr/server/server.html
OS : Ubuntu 16.04 LTS 

1. dmidecode
– DMI table decoder

# apt-get install dmidecode

:: 실서버
# dmidecode -s system-manufacturer
System manufacturer

:: 가상서버
# dmidecode -s system-manufacturer
OpenStack Foundation

 

2. fecter
– Gather system infomation
– Collect and display facts about the system.

:: 실서버
# facter 2> /dev/null | grep virtual
is_virtual => false
virtual => physical

:: 가상서버
# facter 2> /dev/null | grep virtual
is_virtual => true
virtual => kvm

 

3. lshw
– list hardware

:: 실서버
# lshw -class system
chonnom 
 description: Desktop Computer
 product: System Product Name (To Be Filled By O.E.M.)
 vendor: System manufacturer
 version: System Version
 serial: System Serial Number
 width: 64 bits
 capabilities: smbios-2.5 dmi-2.5 vsyscall32
 configuration: boot=normal chassis=desktop family=To Be Filled By O.E.M. 
                      sku=To Be Filled By O.E.M. uuid=E0326F05-8EFE-D511-884B-F46D04D2EF96

:: 가상서버
# lshw -class system
mojily-3340 
 description: Computer
 product: OpenStack Nova
 vendor: OpenStack Foundation
 version: 13.1.2
 serial: 7147e77f-cc07-9fbc-1042-1c75580ef237
 width: 64 bits
 capabilities: smbios-2.8 dmi-2.8 vsyscall32
 configuration: boot=normal family=Virtual Machine uuid=7E7F3356-7641-D44E-AA09-7DBC84E85B0D

 

4. dmesg
– print or control the kernel ring buffer

:: 실서버
# dmesg |grep "Hypervisor"

:: 가상서버
# dmesg |grep "Hypervisor"
[ 0.000000] Hypervisor detected: KVM

 

5. hostnamectl
– Control the system hostname

:: 실서버
# hostnamectl
 Static hostname: chonnom
 Pretty hostname: CHONNOM
 Icon name: computer-desktop
 Chassis: desktop
 Machine ID: c1b0b3f716774db991030221bf09c09f
 Boot ID: 07b97a3e6a6c43f3a137787bf42a79d7
 Operating System: Ubuntu 16.04.2 LTS
 Kernel: Linux 4.4.0-93-generic
 Architecture: x86-64

:: 가상서버
# hostnamectl
 Static hostname: mojily-3340
 Icon name: computer-vm
 Chassis: vm
 Machine ID: 56337f7e41764ed4aa097dbc84e85b0d
 Boot ID: 90f2a54bfae4425fad11253d0fc45aa1
 Virtualization: kvm
 Operating System: Ubuntu 16.04.2 LTS
 Kernel: Linux 4.4.0-93-generic
 Architecture: x86-64

 

6. systemd-detect-virt
– Detect execution in a virtualized environment

:: 실서버 
# systemd-detect-virt
none

:: 가상서버 
 # systemd-detect-virt
kvm

※ 이외에도 imvirt(perl),  virt-what 명령어를 통해서도 가능합니다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 항목은 *(으)로 표시합니다