Profile picture

[Linux] 시스템 구성 정보 확인하기

JaehyoJJAng2024년 12월 05일

개요

이번 게시글에서는 시스템 구성 정보를 확인할 수 있는 여러 명령어를 기록해보려고 합니다!


커널 정보 확인하기

uname (Unix NAME)

uname -a

Linux arch 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 GNU/Linux

운영체제의 정확한 버전을 알고 싶다면 다음과 같이 확인할 수 있습니다!

cat /etc/*-release

NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
...
...

dmesg (Display Message, Driver Message)

dmesg 명령어를 통해서 커널이 부팅할 때 나오는 메시지와 운영 중에 발생하는 메시지를 볼 수 있어요!

  • 커널이 메모리를 인식하는 과정
  • 하드웨어를 인식하고 드라이브를 올리는 과정
  • 부팅 시 적용된 커널 파라미터
dmesg | grep -i kernel | more

[    0.017984] Booting paravirtualized kernel on KVM
[    0.022156] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=/dev/mapper/vg0-lv_root rw loglevel=3 quiet
[    0.022195] Unknown kernel command line parameters "BOOT_IMAGE=/vmlinuz-linux", will be passed to user space.
[    0.042375] Memory: 5903700K/6143456K available (18432K kernel code, 2177K rwdata, 13440K rodata, 3436K init, 3484K bss, 239496K reserved, 0K cma-reserved)
[    0.186447] DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
[    0.186503] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.186574] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.377880] Loaded X.509 cert 'Build time autogenerated kernel key: 0053407a583e4abf791c272ae6ca151222bca233'
[    0.390607] Freeing unused kernel image (initmem) memory: 3436K
[    0.390618] Write protecting the kernel read-only data: 32768k
[    0.390819] Freeing unused kernel image (rodata/data gap) memory: 896K
[    2.153879] systemd[1]: Listening on udev Kernel Socket.
[    2.156875] systemd[1]: Mounting Kernel Debug File System...
[    2.159111] systemd[1]: Mounting Kernel Trace File System...
[    2.163232] systemd[1]: Starting Load Kernel Module configfs...
[    2.166052] systemd[1]: Starting Load Kernel Module dm_mod...
[    2.166602] systemd[1]: Starting Load Kernel Module drm...
[    2.168440] systemd[1]: Starting Load Kernel Module fuse...
[    2.169718] systemd[1]: Starting Load Kernel Module loop...
[    2.186651] systemd[1]: Starting Load Kernel Modules...
[    2.188412] systemd[1]: Starting Generate network units from Kernel command line...
[    2.189422] systemd[1]: Starting Remount Root and Kernel File Systems...
[    2.193902] systemd[1]: Mounted Kernel Debug File System.
[    2.193943] systemd[1]: Mounted Kernel Trace File System.
[    2.195383] systemd[1]: Finished Load Kernel Module configfs.
[    2.195601] systemd[1]: Finished Load Kernel Module dm_mod.
[    2.195791] systemd[1]: Finished Load Kernel Module drm.
[    2.195978] systemd[1]: Finished Load Kernel Module fuse.
[    2.198664] systemd[1]: Mounting Kernel Configuration File System...
[    2.202361] systemd[1]: Finished Load Kernel Module loop.
[    2.202533] systemd[1]: Finished Load Kernel Modules.
[    2.202647] systemd[1]: Mounted Kernel Configuration File System.
[    2.206645] systemd[1]: Starting Apply Kernel Variables...
[    2.213507] systemd[1]: Finished Generate network units from Kernel command line.
[    2.217670] systemd[1]: Finished Apply Kernel Variables.
[    2.219402] systemd[1]: Finished Remount Root and Kernel File Systems.

/boot/config-$(uname -r) 파일 시스템 조회를 통해서 부팅 커널 컴파일 파라미터 확인도 가능해요!

cat /boot/config-$(uname -r) | more

CPU 정보 확인하기

dmidecode -t processor

dmidecode 명령어를 통해서 CPU(Processor) 정보를 확인할 수 있어요.

dmidecode -t processor

dmidecode -t processor의 결과로 Socket, Core Count, Thread Count 정보를 확인할 수 있습니다.

  • Socket: 물리적 CPU
  • Core Count: CPU 코어 개수
  • Thread Count: 하어퍼스레딩 기술을 통해서 사용가능한 멀티코어 개수. 논리적 코어 개수.

또한 /proc/cpuinfo 파일 시스템을 조회하는 방법으로도 CPU에 대한 정보를 확인할 수 있어요.

여기서 각각의 Processor는 위에서 확인한 Thread와 동일한 논리적 코어를 의미합니다.

cat /proc/cpuinfo

추가적으로 lscpu 명령어를 통해서 집계된 CPU 정보를 확인할 수도 있답니다!

lscpu

Bios 버전 확인하기

sudo dmidecode -t bios

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: American Megatrends International, LLC.
        Version: P1.70
        Release Date: 07/01/2021
        Address: 0xF0000
        Runtime Size: 64 kB
        ROM Size: 16 MB
        Characteristics:
                PCI is supported
        ....
        ....

장치 모델명 / 제조사 확인하기

모델명을 통해서 해당 장비가 어느 정도의 성능을 낼 수 있는지 확인할 수 있어요.

sudo dmidecode -t system

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: To Be Filled By O.E.M.
        ....
        ....

메모리 정보 확인하기

dmidecode -t memory

dmidecode -t memory 명령어를 통해서 메모리 보드와 메모리를 확인할 수 있어요.

  • Physical Memory Array: 메모리가 꽂혀있는 보드
  • Memory Device: 실제로 시스템에 꽂혀 있는 메모리 장비
sudo dmidecode -t memory

# ...
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
# ...

Handle 0x1100, DMI type 17, 40 bytes
Memory Device
# ...

Handle 0x1100, DMI type 17, 40 bytes
Memory Device
# ...

메모리 카드가 많은 경우에는 다음과 같이 Memory Device만 필터링해서 확인할 수 있습니다.

dmidecode -t memory | grep -i "size:"

디스크 정보 확인하기

df (Disk Free)

df 명령어를 통해서 파티션과 디스크 타입을 확인할 수 있어요!


  • hda: IDE(Integrated Drive Electronics, 주로 개인용 인터페이스) 방식의 디스크입니다.
  • sda: SCSI(Small Computer System Interface, 주로 서버용 인터페이스) 방식의 디스크와 최근에 나오는 SATA(Serial Advanced Technology Attachment), SAS(Serial Attached SCSI)와 같은 일반적인 하드디스크입니다.
  • vda: 가상서버에서 흔히 볼 수 있는 디스크 타입이며 하이퍼바이저 위에서 동작 중인 서버에서 볼 수 있습니다.

여기서 만약 내가 운영중인 시스템이 가상 서버인지 확인하는 방법은 다음과 같아요!

# 실사
dmidecode -s system-product-name
> Asus Vibo...

# 가상
dmidecode -s system-product-name
> OpenStack Nova

smartctl

smartctl 명령어를 통해서 디스크의 물리적인 정보(제조사, 시리얼번호, 펌웨어 버전)를 확인할 수 있어요.

RAID 컨트롤러를 통해서 만들어진 논리적 볼륨의 경우에는 RAID 컨트롤러를 -d 옵션에 추가하여 디스크의 정보 확인이 가능합니다.

smartctl -a <디스크위치> -d <RAID_컨트롤러>,<디스크베이번호>
smartctl -a /dev/sda -d raidname,0

네트워크 정보 확인하기

lspci (List PCI)

lspci 명령어를 통해서 네트워크 카드 정보 확인이 가능해요.

lspci | grep -i ether

링버퍼 크기 확인해보기

ethtool -g <interface_name>

Ring parameters for enp0s3:
Pre-set maximums: # maximums (하드웨어가 지원하는 최대 ring buffer 크기)
RX:		4096
RX Mini:	0
RX Jumbo:	0
TX:		4096
Current hardware settings: # current (현재 설정된 최대 ring buffer 크기)
RX:		256
RX Mini:	0
RX Jumbo:	0
TX:		256

maximums 값과 current 값이 같도록 설정하는걸 권장하고 있어요.

ethtool

ethtool 명령어를 통해서 해당 네트워크 카드가 어느정도의 속도까지 지원할 수 잇는지,

연결되어 있는 속도는 얼마인지, 네트워크 연결은 정상적인지 확인이 가능합니다.


  • 1000baseT/Half 1000baseT/Full -> 최대 1000Mb/s를 지원함을 의미
  • Speed: 1000Mb/s -> 현재 속도
  • Link detected: yes -> 네트워크 연결 정상 여부

ethtool <interface_name>

Settings for ens1:
        Supported ports: [ TP ]
        # 지원 속도
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        # 지원 속도
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
# ...
        # 현재 속도
        Speed: 1000Mb/s
# ...
        # 네트워크 연결 정상 여부
        Link detected: yes

ethtool -i를 통해서 네트워크 카드의 자세한 정보를 확인할 수 있습니다.

특정 커널 드라이버에서 문제가 생겼을 경우 서버의 네트워크 카드가 어떤 커널 드라이버를 사용하는지 확인할 때 사용합니다.

ethtool -i

driver: tg3
version: 3.137
firmware-version: FFV20.6.52 bc 5720-v1.39
expansion-rom-version:
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
    Tag -

Loading script...