반응형

Load Average 정의


Load Average는 프로세스의 상태 중 R&D 상태에 있는 프로세스의 개수의 1, 5, 15분 마다의 평균 값입니다.

root@choi:/proc/1# uptime

00:22:03 up 38 days, 2:18, 2 users, load average: 0.00, 0.00, 0.00

, 얼마나 많은 프로세스가 실행 중 혹은 실행 대기 중이냐를 의미한다. Load Average가 높다면 프로세스가 실행 중이거나 I/O 등을 처리하기 위한 대기상태에 있다는 것이며, 낮다면 적은 수의 프로세스가 실행 중이거나 대기 중이라는 의미이다. 프로세스의 수를 세는 것이기 때문에 CPU Core 수에 따라 의미가 다소 상대적이다.

Load Average를 보다 자세히 분석하기 위해 strace를 이용해 보겠습니다.

root@choi:~# uptime

21:07:03 up 39 days, 23:03, 2 users, load average: 0.00, 0.00, 0.00

root@choi:~# strace -s 65535 -f -t -o uptime_dump uptime

21:07:28 up 39 days, 23:04, 2 users, load average: 0.00, 0.00, 0.00


uptime 명령은 /proc/loadavg 파일을 열어서 그 파일의 내용을 읽고 화면에 출력해주는 명령어이다. uptime이 계산하는 것이 아니고 커널이 미리 계산한 내용을 보여주게 된다. 커널은 Tick주기 마다 깨어나서 CPURun Queue에 있는 프로세스의 개수를 넣어서 계산한다. 과정은 복잡하게 보일 수 있지만, 결국에는 프로세스의 개수를 카운트 한다는 점이다.


9243  21:07:28 openat(AT_FDCWD, "/proc/loadavg", O_RDONLY) = 4

9243  21:07:28 lseek(4, 0, SEEK_SET)    = 0

9243  21:07:28 read(4, "0.00 0.00 0.00 1/384 9244\n", 8191) = 26

9243  21:07:28 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0

9243  21:07:28 write(1, " 21:07:28 up 39 days, 23:04,  2 users,  load average: 0.00, 0.00, 0.00\n", 71) = 71

9243  21:07:28 close(1)                 = 0

9243  21:07:28 close(2)                 = 0

9243  21:07:28 exit_group(0)            = ?

9243  21:07:28 +++ exited with 0 +++ 


 

Load Average가 높다는 것은 단순히 CPU를 사용하려는 프로세스가 많다는 의미도 포함해서 I/O에 병목이 생겨서 I/O 작업을 대기하는 프로세스가 많다는 의미도 있습니다. 아래의 코드를 바탕으로 CPU IO 리소스가 많이 사용해서 발생하는 부하에 대해 확인 할수 있다. 중요한 것은 Load Average가 높다고 무조건 CPU를 더 장착할 필요가 없다는 점이다.

#!/bin/bash

 

if [ $1 = "CPU" ]

then

while [ 1 ]

do

echo "1+1"|bc >& /dev/null

done

fi

 

if [ $1 = "IO" ]

then

while [ 1 ]

do

echo test > test.txt

done

fi


root@choi:/# ./test.sh CPU&

[1] 9448

root@choi:/# uptime

21:35:29 up 39 days, 23:32, 2 users, load average: 0.08, 0.02, 0.01

root@choi:/# uptime

21:35:38 up 39 days, 23:32, 2 users, load average: 0.23, 0.05, 0.02

root@choi:/# uptime

21:35:45 up 39 days, 23:32, 2 users, load average: 0.43, 0.10, 0.03

root@choi:/# ./test.sh IO&

[1] 28289

root@choi:/# uptime

21:36:45 up 39 days, 23:33, 2 users, load average: 0.75, 0.25, 0.09

root@choi:/# uptime

21:36:57 up 39 days, 23:33, 2 users, load average: 0.79, 0.27, 0.10

root@choi:/# uptime

21:37:01 up 39 days, 23:33, 2 users, load average: 0.81, 0.29, 0.11

 

 

 

root@choi:/# ./test.sh IO&

[1] 19321

root@choi:/# vmstat 1

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wa st

0 1 9216 297768 7101296 8321568 0 0 0 62496 16165 47336 5 19 75 2 0

1 0 9216 297832 7101296 8321572 0 0 0 63252 16348 47953 7 17 76 1 0

0 1 9216 297856 7101296 8321572 0 0 0 63312 16339 47985 5 19 75 1 0

1 0 9216 297848 7101296 8321572 0 0 0 63264 16350 47992 5 19 75 1 0

1 0 9216 297840 7101296 8321568 0 0 0 63332 16352 47969 6 18 75 1 0

0 1 9216 297864 7101300 8321572 0 0 0 62528 16164 47326 5 18 74 2 0

1 0 9216 297864 7101300 8321572 0 0 0 63232 16332 47942 5 19 75 1 0

0 1 9216 297888 7101300 8321572 0 0 0 63288 16319 48000 5 20 74 1 0

1 0 9216 297888 7101300 8321572 0 0 0 63228 16336 47933 6 19 75 1 0

root@choi:/# ./test.sh CPU >/dev/null&

[1] 19328

root@choi:/# vmstat 1

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wa st

1 0 9216 296692 7101384 8321572 0 0 2 4 2 1 0 0 100 0 0

3 0 9216 296652 7101384 8321572 0 0 0 0 1052 14372 11 23 67 0 0

1 0 9216 296504 7101384 8321572 0 0 0 0 1064 14440 10 23 67 0 0

1 0 9216 296192 7101384 8321572 0 0 0 0 1070 14447 8 25 67 0 0

2 0 9216 296444 7101384 8321572 0 0 0 0 1051 14459 9 24 67 0 0

2 0 9216 295960 7101384 8321572 0 0 0 0 1048 14365 10 23 67 0 0

1 0 9216 296440 7101384 8321572 0 0 0 0 1049 14413 10 23 67 0 0

2 0 9216 296588 7101384 8321572 0 0 0 0 1064 14424 9 24 67 0 0

1 0 9216 296768 7101384 8321572 0 0 0 68 1052 14454 10 23 67 0 0

다음은 vmstat를 이용해서 부하의 원인을 분석하는 방법을 알아보고자 한다. 첫 번째 , 두 번째 칼럼의 차이가 보인다.

r은 실행되기를 기다리거나 실행되고 있는 프로세스의 개수, bI/O를 위해 대기열에 있는 프로세스의 개수를 말한다.

 

ex) CPU기반의 부하를 일으키는 경우 : 응답속도가 느려진다. nginxjava같은 실제 서비스를 방해하는 프로세스로 인해 전체적인 응답속도가 느려지게 된다.

I/O기반의 부하를 일으키는 경우 : CPU 경합이 떨어지기 때문에 다소 응답속도가 느려지지 않지만, I/O가 들어가는 경우 I/O에 의한 병목현상이 발생할 수 있다.

 

 

 

 

 

반응형
반응형

1)top - 23:34:08 up 38 days, 1:31, 2)2 users, load average: 0.02, 0.01, 0.00

3)Tasks: 226 total, 1 running, 225 sleeping, 0 stopped, 0 zombie

4)%Cpu(s): 1.6 us, 1.6 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

MiB Mem : 15923.4 total, 633.3 free, 578.7 used, 14711.5 buff/cache

MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 14918.0 avail Mem

 

PID USER 5)PR 6)NI 7)VIRT 8)RES 9)SHR 10)S %CPU %MEM TIME+ COMMAND

1 root 20 0 226244 9888 6856 S 0.0 0.1 0:53.39 systemd

2 root 20 0 0 0 0 S 0.0 0.0 0:00.41 kthreadd

4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H

6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq

7 root 20 0 0 0 0 S 0.0 0.0 0:04.42 ksoftirqd/0


1)top - 23:34:08 up 38 days

현재 시스템의 시간과 서버가 얼마나 구동되었는지 구동시간이 나와있다

 

2)2 users, load average: 0.02, 0.01, 0.00

몇 명의 사용자가 로그인해 있는지, 시스템의 Load Average는 어느 정도인지 보여준다. Load Average는 현재 시스템이 얼마나 많은 일을 하고 있는지를 보여주는 데이터이다.

 

3)Tasks: 226 total, 1 running, 225 sleeping, 0 stopped, 0 zombie

현재 시스템에 구동중인 프로세스의 개수를 나타낸다. 또한 프로세스 상태에 대한 통계 정보 제공

 

4)%Cpu(s): 1.6 us, 1.6 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

MiB Mem : 15923.4 total, 633.3 free, 578.7 used, 14711.5 buff/cache

MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 14918.0 avail Mem

CPU, MEM, SWAP 메모리의 사용량이다.


 

5)PR은 프로세스의 실행 우선순위이며 6)NIPR을 얼만큼 조절할건지를 의미한다. 기본적으로 5)PR6)NI를 더해서 실제 우선순위를 계산한다.

 

7)VIRTTASK(프로세스)가 사용하고 있는 Virtual Memory의 전체 용량

8)RES는 현재 TASK가 사용하고 있는 물리 메모리의 양

9)SHR는 다른 프로세스와 공유하고 있는 공유메모리의 양

, VIRT는 프로세스의 할당된 가상메모리 전체크기 이며 RES는 기중 실제로 메모리에 올려서 사용하고 있는 물리 메모리의 크기이고 SHR은 다른 프로세스와 공유하고 있는 메모리의 크기이다

 

10)S는 프로세스의 상태이다.

반응형
반응형

네트워크 카드 정보 역시 하드웨어 적인 이슈를 확인 할 때 매우 유용하게 사용된다.

root@choi:/media# lspci |grep -i ether

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04) 


위 시스템은 인텔에서 인보드 형태로 만든  82579M 모델이고 기가비트 네트워크 카드 입니다. 이 정보가 중요한 이유는 가혹 특정 모델에서 버그나 이슈가 보고 될때 자신의 시스템이 해당되는지 확인해야 되고 관련된 펌웨어를 찾기 위함입니다.


이번에는 ethtool을 이용해서 연결 상태를 확인해 보겠습니다.

root@choi:/media# ethtool eth0

Settings for eth0:

        Supported ports: [ TP ]

        Supported link modes:   10baseT/Half 10baseT/Full

                                100baseT/Half 100baseT/Full

                                1000baseT/Full

        Supported pause frame use: No

        Supports auto-negotiation: Yes

        Supported FEC modes: Not reported

        Advertised link modes:  10baseT/Half 10baseT/Full

                                100baseT/Half 100baseT/Full

                                1000baseT/Full

        Advertised pause frame use: No

        Advertised auto-negotiation: Yes

        Advertised FEC modes: Not reported

        Speed: 1000Mb/s

        Duplex: Full

        Port: Twisted Pair

        PHYAD: 1

        Transceiver: internal

        Auto-negotiation: on

        MDI-X: on (auto)

        Supports Wake-on: pumbg

        Wake-on: g

        Current message level: 0x00000007 (7)

                               drv probe link

        Link detected: yes 


ethtool을 통해서 확인할 수 있는 정보는 우선 해당 네트워크 카드가 어느정도 속도 까지 지원되는지 확인이 가능하고 현재 연결된 스피드, 네트워크 연결상태의 정상 유무를 확인 할수 잇습니다.


또한 ethtool을 이용해서 네트워크 카드의 여러가지 세팅 정보도 확인이 가능합니다.


-g 옵션을 이용해서 Ring Buffer의 크기를 확인 할 수 있고 -G 옵션을 이용해서 Ring buffer의 사이즈를 조절할 수 있습니다.

root@choi:/media# ethtool -g eth0

Ring parameters for eth0:

Pre-set maximums:

RX:             4096

RX Mini:        0

RX Jumbo:       0

TX:             4096

Current hardware settings:

RX:             256

RX Mini:        0

RX Jumbo:       0

TX:             256


root@choi:/media# ethtool -G eth0 rx 300

root@choi:/media# ethtool -g eth0

Ring parameters for eth0:

Pre-set maximums:

RX:             4096

RX Mini:        0

RX Jumbo:       0

TX:             4096

Current hardware settings:

RX:             304

RX Mini:        0

RX Jumbo:       0

TX:             256 



-k 옵션을 이용해서 현재 사용중인 옵션을 이용해서 네트워크 카드의 다양한 성능 최적화 옵션을 확인 할 수 있고 -K 옵션을 이용해서 성능 최적화를 설정할 수 있습니다.

root@choi:/media# ethtool -k eth0

Features for eth0:

rx-checksumming: on

tx-checksumming: on

        tx-checksum-ipv4: off [fixed]

        tx-checksum-ip-generic: on

        tx-checksum-ipv6: off [fixed]

        tx-checksum-fcoe-crc: off [fixed]

        tx-checksum-sctp: off [fixed]

scatter-gather: on

        tx-scatter-gather: on

        tx-scatter-gather-fraglist: off [fixed]

tcp-segmentation-offload: on

        tx-tcp-segmentation: on

        tx-tcp-ecn-segmentation: off [fixed]

        tx-tcp-mangleid-segmentation: off

        tx-tcp6-segmentation: on

udp-fragmentation-offload: off

generic-segmentation-offload: on

generic-receive-offload: on

...중략...


root@choi:/media# ethtool -K eth0  gro off

root@choi:/media# ethtool -k eth0

Features for eth0:

rx-checksumming: on

tx-checksumming: on

        tx-checksum-ipv4: off [fixed]

        tx-checksum-ip-generic: on

        tx-checksum-ipv6: off [fixed]

        tx-checksum-fcoe-crc: off [fixed]

        tx-checksum-sctp: off [fixed]

scatter-gather: on

        tx-scatter-gather: on

        tx-scatter-gather-fraglist: off [fixed]

tcp-segmentation-offload: on

        tx-tcp-segmentation: on

        tx-tcp-ecn-segmentation: off [fixed]

        tx-tcp-mangleid-segmentation: off

        tx-tcp6-segmentation: on

udp-fragmentation-offload: off

generic-segmentation-offload: on

generic-receive-offload: off

...중략...


여기서 제가 off한 기능은 tcp-offload 기능인데 이 기능은 MTU 이상의 크기를 가지는 패킷의 분할 작업을 CPU가 아닌 네트워크 카드가 직접 함으로서 CPU의 부담을 줄이고 패킷 처리 성능을 높이는 기능입니다. 하지만 이 기능은 네트워크 대역폭이 너무 높은 서버들에서 이슈를 일으킬 수 있기 때문에 불특정한 패킷 유실이 일어나는 것 같다면 기능을 off 하는것이 좋다. 

반응형
반응형

dmidecode 메모리 키워드를 이용해서 메모리의 정보 및 제조사 까지 확인이 가능합니다.

root@choi:~# dmidecode -t memory

# dmidecode 3.1

Getting SMBIOS data from sysfs.

SMBIOS 2.6 present.


Handle 0x0005, DMI type 16, 15 bytes

Physical Memory Array

        Location: System Board Or Motherboard

        Use: System Memory

        Error Correction Type: None

        Maximum Capacity: 16 GB

        Error Information Handle: Not Provided

        Number Of Devices: 2


Handle 0x0006, DMI type 17, 28 bytes

Memory Device

        Array Handle: 0x0005

        Error Information Handle: Not Provided

        Total Width: 64 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: SODIMM

        Set: None

        Locator: ChannelA-DIMM0

        Bank Locator: BANK 0

        Type: DDR3

        Type Detail: Synchronous

        Speed: 1333 MT/s

        Manufacturer: Samsung

        Serial Number: 0057F09A

        Asset Tag: 9876543210

        Part Number: M471B1G73EB0-YK0

        Rank: Unknown


Handle 0x0007, DMI type 17, 28 bytes

Memory Device

        Array Handle: 0x0005

        Error Information Handle: Not Provided

        Total Width: 64 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: SODIMM

        Set: None

        Locator: ChannelB-DIMM0

        Bank Locator: BANK 2

        Type: DDR3

        Type Detail: Synchronous

        Speed: 1333 MT/s

        Manufacturer: Samsung

        Serial Number: 8608E3FF

        Asset Tag: 9876543210

        Part Number: M471B1G73EB0-YK0

        Rank: Unknown 


메모리 키워드에서는 크게 Physical Memory Array와 Memory Device로 나누어집니다.


Physical Memory Array는 하나의 CPU 소켓에 함께 할당 된 물리 메모리의 그룹을 의미합니다. CPU(프로세서)는 NUMA라는 개념을 이용해서 CPU가 사용해서 각각의 CPU가 사용할 수 있는 로컬 메모리를 제공합니다. Physical Memory Array는 이 개념에서 시작하며, 지금 보고 있는 시스템은 1개의 CPU 소켓이 있기에 Physical Memory Array 영역도 1개 존재합니다. 


Memory Device는 실제로 시스템에 꽂혀 있는 메모리를 의미하고 용량 및 제조사를 포함한 상세 스펙을 제공합니다.


다음은 디스크 정보를 확인하겠습니다.


디스크 정보를 확인하는 과정에서 가장 중요한 거는 물리적인 디바이스와 파일시스템 기준의 정보를 확인하는 방법 입니다.


먼저 파일시스템 기준으로 현재 시스템을 구성하고 있는 있는 파일 시스템을 확인하겠습니다.


root@choi:~# df -h

Filesystem      Size  Used Avail Use% Mounted on

udev            7.8G     0  7.8G   0% /dev

tmpfs           1.6G  3.3M  1.6G   1% /run

/dev/sda1       458G   31G  404G   8% /

tmpfs           7.8G  8.0K  7.8G   1% /dev/shm

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup

tmpfs           1.6G   16K  1.6G   1% /run/user/127

tmpfs           1.6G     0  1.6G   0% /run/user/1000

/dev/sdb1       8.0G  2.2G  5.9G  27% /media/storage

/dev/sdb2       924G  801G  124G  87% /media/choi 


tmpfs를 제외하고 보게 되면 현재 시스템에는 /dev/sda1, /dev/sdb1, /dev/sdb2 이렇게 3개의 시스템이 마운트가 되어 있는것을 알 수 있습니다.


여기서 디스크명이 sda로 나와 있는데 있는데 이부분이 hda, vda 일수도 있습니다. 이 차이점에 대해서 알아보겠습니다.

시스템이 디스크와 통신하기 위해서 컨트롤러라는 부품이 있습니다  컨트롤러는 디스크를 사용하려는 쪽과 실제 디스크 사이에서 통신이 원할하게 이루어질 수 있도록 일종의 중개자 역할을 하는데 이 부품에 크게 2가지 타입이 있습니다. 2가지 타입은 IDE 와 SCSI 타입입니다. IDE는 개인용 컴퓨터를 위한 방식(병렬 통신), SCSI는 서버용 컴푸터를 이한 방식(직렬통신)이라고 볼수 있습니다. 현재 IDE는 대부분 사장되어 있는점 확인 부탁드립니다.


다음은 디스크 정보를 확인하는 방법입니다. 먼저 fdisk, parted 2개를 이용할 수 있는데 fdisk는 mbr 타입으로 디스크를 검색하고 parted는 gpt 타입으로 디스크를 검색하게 됩니다. 

root@choi:/media# fdisk -l


Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x040027c3


Device     Boot Start       End   Sectors   Size Id Type

/dev/sda1  *     2048 976771071 976769024 465.8G 83 Linux



Disk /dev/sdb: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x87bf995a


Device     Boot    Start        End    Sectors   Size Id Type

/dev/sdb1           2048   16779263   16777216     8G  c W95 FAT32 (LBA)

/dev/sdb2       16779264 1953519615 1936740352 923.5G  7 HPFS/NTFS/exFAT


root@choi:/media# parted -l

Model: ATA Samsung SSD 840 (scsi)

Disk /dev/sda: 500GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:


Number  Start   End    Size   Type     File system  Flags

 1      1049kB  500GB  500GB  primary  ext4         boot



Model: Seagate FreeAgent GoFlex (scsi)

Disk /dev/sdb: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:


Number  Start   End     Size    Type     File system  Flags

 1      1049kB  8591MB  8590MB  primary  fat32        lba

 2      8591MB  1000GB  992GB   primary  ntfs 


마지막으로 디스크의 상세 스펙을 확인하는 명령어를 알아보겠습니다.


smartctl 명령에 다양한 옵션을 통해 해당 디스크의 정보 및 상태에 대해서 알아볼수 있습니다. 상세한 옵션은 man 페이지를 확인 가능합니다.

저는 보통 -iA (기본 정보 및 스마트 데이터)를 사용합니다.

root@choi:/media# smartctl -iA /dev/sda

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-22-generic] (local build)

Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org


=== START OF INFORMATION SECTION ===

Model Family:     Samsung based SSDs

Device Model:     Samsung SSD 840 EVO 500GB

Serial Number:    S1DHNWAG200050A

LU WWN Device Id: 5 002538 870095d40

Firmware Version: EXT0DB6Q

User Capacity:    500,107,862,016 bytes [500 GB]

Sector Size:      512 bytes logical/physical

Rotation Rate:    Solid State Device

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4c

SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)

Local Time is:    Sat Aug  4 17:43:44 2018 KST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled


=== START OF READ SMART DATA SECTION ===

SMART Attributes Data Structure revision number: 1

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0

  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       5601

 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       755

177 Wear_Leveling_Count     0x0013   099   099   000    Pre-fail  Always       -       10

179 Used_Rsvd_Blk_Cnt_Tot   0x0013   100   100   010    Pre-fail  Always       -       0

181 Program_Fail_Cnt_Total  0x0032   100   100   010    Old_age   Always       -       0

182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0

183 Runtime_Bad_Block       0x0013   100   100   010    Pre-fail  Always       -       0

187 Uncorrectable_Error_Cnt 0x0032   100   100   000    Old_age   Always       -       0

190 Airflow_Temperature_Cel 0x0032   064   052   000    Old_age   Always       -       36

195 ECC_Error_Rate          0x001a   200   200   000    Old_age   Always       -       0

199 CRC_Error_Count         0x003e   099   099   000    Old_age   Always       -       240

235 POR_Recovery_Count      0x0012   099   099   000    Old_age   Always       -       161

241 Total_LBAs_Written      0x0032   099   099   000    Old_age   Always       -       5460875549 


보시는 바와 같이 상세 모델명과 펌웨어버젼 그리고 상태 정보까지 모니터링 가능합니다. smart 데이터는 추후에 다시 이야기하도록 하겠습니다.

반응형
반응형

이번에는 CPU와 BIOS 정보를 확인하는 방법을 살펴보겠습니다.


리눅스에서는 dmidecode 명령을 통해 하드웨어 정보를 확인 합니다. 

보통 dmidecode를 사용하게 되면 너무 많은 정보가 나오기 때문에 적절하게 옵션을 선택해서 필요한 정보를 취사 선택 하는것이 중요합니다.


시작하기에 앞서 man을 이용해서 dmdecode에서 확인 가능한 정보 리스트를 확인 해보도록 하겠습니다.

       Type   Information

       ────────────────────────────────────────────

          0   BIOS

          1   System

          2   Baseboard

          3   Chassis

          4   Processor

          5   Memory Controller

          6   Memory Module

          7   Cache

          8   Port Connector

          9   System Slots

         10   On Board Devices

         11   OEM Strings

         12   System Configuration Options

         13   BIOS Language

         14   Group Associations

         15   System Event Log

         16   Physical Memory Array

         17   Memory Device

         18   32-bit Memory Error

         19   Memory Array Mapped Address

         20   Memory Device Mapped Address

         21   Built-in Pointing Device

         22   Portable Battery

         23   System Reset

         24   Hardware Security

         25   System Power Controls

         26   Voltage Probe

         27   Cooling Device


         28   Temperature Probe

         29   Electrical Current Probe

         30   Out-of-band Remote Access

         31   Boot Integrity Services

         32   System Boot

         33   64-bit Memory Error

         34   Management Device

         35   Management Device Component

         36   Management Device Threshold Data

         37   Memory Channel

         38   IPMI Device

         39   Power Supply

         40   Additional Information

         41   Onboard Devices Extended Information

         42   Management Controller Host Interface 


다양한 정보를 확인 할 수 있는 만큼 적절하게 사용하게 되면 업무에 많은 도움이 될 수 있습니다. (특히 서버 환경에서 ...)


먼저 bios를 확인해 보겠습니다

root@choi:~# dmidecode  -t bios

# dmidecode 3.1

Getting SMBIOS data from sysfs.

SMBIOS 2.6 present.


Handle 0x000D, DMI type 0, 24 bytes

BIOS Information

        Vendor: LENOVO

        Version: 8DET72WW (1.42 )

        Release Date: 02/18/2016

        Address: 0xE0000

        Runtime Size: 128 kB

        ROM Size: 8192 kB

        Characteristics:

                PCI is supported

                PNP is supported

                BIOS is upgradeable

                BIOS shadowing is allowed

                Boot from CD is supported

                Selectable boot is supported

                EDD is supported

                3.5"/720 kB floppy services are supported (int 13h)

                Print screen service is supported (int 5h)

                8042 keyboard services are supported (int 9h)

                Serial services are supported (int 14h)

                Printer services are supported (int 17h)

                CGA/mono video services are supported (int 10h)

                ACPI is supported

                USB legacy is supported

                BIOS boot specification is supported

                Targeted content distribution is supported

        BIOS Revision: 1.42

        Firmware Revision: 1.24


Handle 0x002B, DMI type 13, 22 bytes

BIOS Language Information

        Language Description Format: Abbreviated

        Installable Languages: 1

                en-US

        Currently Installed Language: en-US 


보통 bios 키워드는 특정 BIOS 버젼에 문제가 있다는 보고가 있고 내가 사용하는 버젼이 이에 해당하는지 확인하기 위해서 사용 합니다.


다음은 가장 많이 사용하게 되는 system입니다.


root@choi:~# dmidecode  -t system

# dmidecode 3.1

Getting SMBIOS data from sysfs.

SMBIOS 2.6 present.


Handle 0x000E, DMI type 1, 27 bytes

System Information

        Manufacturer: LENOVO

        Product Name: 4290P13

        Version: ThinkPad X220

        Serial Number: R9FPDTG

        UUID: 93D38881-50A9-11CB-BE41-FD560931E6E9

        Wake-up Type: Power Switch

        SKU Number: Not Specified

        Family: ThinkPad X220


Handle 0x002A, DMI type 12, 5 bytes

System Configuration Options


Handle 0x0038, DMI type 15, 29 bytes

System Event Log

        Area Length: 66 bytes

        Header Start Offset: 0x0000

        Header Length: 16 bytes

        Data Start Offset: 0x0010

        Access Method: General-purpose non-volatile data functions

        Access Address: 0x00F0

        Status: Valid, Not Full

        Change Token: 0x00000003

        Header Format: Type 1

        Supported Log Type Descriptors: 3

        Descriptor 1: POST error

        Data Format 1: POST results bitmap

        Descriptor 2: Single-bit ECC memory error

        Data Format 2: Multiple-event

        Descriptor 3: Multi-bit ECC memory error

        Data Format 3: Multiple-event 


제일 먼저 해당 모델명과 제조사 확인이 가능합니다. 이를 통해 해당 장비의 성능을 낼 수 있는지 확인이 가능합니다. 또한 시스템 이벤트 로그를 보여 줌으로 해당 시스템의 이력을 간단하게 확인 합니다. 


root@choi:~# dmidecode  -t processor

# dmidecode 3.1

Getting SMBIOS data from sysfs.

SMBIOS 2.6 present.


Handle 0x0001, DMI type 4, 42 bytes

Processor Information

        Socket Designation: CPU

        Type: Central Processor

        Family: Core i5

        Manufacturer: Intel(R) Corporation

        ID: A7 06 02 00 FF FB EB BF

        Signature: Type 0, Family 6, Model 42, Stepping 7

        Flags:

                FPU (Floating-point unit on-chip)

                VME (Virtual mode extension)

                DE (Debugging extension)

                PSE (Page size extension)

                TSC (Time stamp counter)

                MSR (Model specific registers)

                PAE (Physical address extension)

                MCE (Machine check exception)

                CX8 (CMPXCHG8 instruction supported)

                APIC (On-chip APIC hardware supported)

                SEP (Fast system call)

                MTRR (Memory type range registers)

                PGE (Page global enable)

                MCA (Machine check architecture)

                CMOV (Conditional move instruction supported)

                PAT (Page attribute table)

                PSE-36 (36-bit page size extension)

                CLFSH (CLFLUSH instruction supported)

                DS (Debug store)

                ACPI (ACPI supported)

                MMX (MMX technology supported)

                FXSR (FXSAVE and FXSTOR instructions supported)

                SSE (Streaming SIMD extensions)

                SSE2 (Streaming SIMD extensions 2)

                SS (Self-snoop)

                HTT (Multi-threading)

                TM (Thermal monitor supported)

                PBE (Pending break enabled)

        Version: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

        Voltage: 1.2 V

        External Clock: 100 MHz

        Max Speed: 2500 MHz

        Current Speed: 2500 MHz

        Status: Populated, Enabled

        Upgrade: ZIF Socket

        L1 Cache Handle: 0x0002

        L2 Cache Handle: 0x0003

        L3 Cache Handle: 0x0004

        Serial Number: Not Supported by CPU

        Asset Tag: None

        Part Number: None

        Core Count: 2

        Core Enabled: 2

        Thread Count: 4

        Characteristics:

                64-bit capable 


먼저 이 시스템은 i5-2520M CPU임을 알수 있고 1CPU에 2코어에 하이퍼 스레딩을 이용해서 4코어를 쓸수 있음을 확인할 수 있습니다.


또한 해당 정보는 cat /proc/cpuinfo , lscpu를 통해서도 같이 확인할 수 있습니다.


root@choi:~# cat /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 42

model name      : Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

stepping        : 7

microcode       : 0x29

cpu MHz         : 879.757

cache size      : 3072 KB

physical id     : 0

siblings        : 4

core id         : 0

cpu cores       : 2

apicid          : 0

initial apicid  : 0

fpu             : yes

fpu_exception   : yes

cpuid level     : 13

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb pti tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts

bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass

bogomips        : 4983.69

clflush size    : 64

cache_alignment : 64

address sizes   : 36 bits physical, 48 bits virtual

power management:

... 중략 ...


root@choi:~# 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:  2

Core(s) per socket:  2

Socket(s):           1

NUMA node(s):        1

Vendor ID:           GenuineIntel

CPU family:          6

Model:               42

Model name:          Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

Stepping:            7

CPU MHz:             953.259

CPU max MHz:         3200.0000

CPU min MHz:         800.0000

BogoMIPS:            4983.69

Virtualization:      VT-x

L1d cache:           32K

L1i cache:           32K

L2 cache:            256K

L3 cache:            3072K

NUMA node0 CPU(s):   0-3

Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb pti tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts

 


반응형
반응형

uname은 리눅스 커널 정보를 확인하는 방법이다.


먼저 man을 이용해서 옵션을 확인하면 다음과 같습니다.


UNAME(1)                         User Commands                        UNAME(1)


NAME

       uname - print system information


SYNOPSIS

       uname [OPTION]...


DESCRIPTION

       Print certain system information.  With no OPTION, same as -s.


       -a, --all

              print  all  information,  in the following order, except omit -p

              and -i if unknown:


       -s, --kernel-name

              print the kernel name


       -n, --nodename

              print the network node hostname


       -r, --kernel-release

              print the kernel release


       -v, --kernel-version

              print the kernel version


       -m, --machine

              print the machine hardware name


       -p, --processor

              print the processor type (non-portable)


       -i, --hardware-platform

              print the hardware platform (non-portable)


       -o, --operating-system

              print the operating system


       --help display this help and exit


       --version

              output version information and exit 


예시를 통해 uname을 통해 시스템 정보를 알아 보도록 합시다


root@choi:~# uname -a

Linux choi 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 


위 시스템의 커널버젼은 4.15.0-22-generic #24-Ubuntu 이고 SMP(멀티코어 시스템)에서 사용되며 X86 계열의 64비트 운영체제를 사용하고 있습니다. 

그리고  5월 16일 수요일 12:15:17설치 된것을 확인 할 수 있습니다.

반응형

+ Recent posts