티스토리 뷰

728x90

리눅스 시스템이 조금 이상하다고 생각이 될 때 디스크를 검사하는 과정을 메모해 두고자 한다.

 

sudo apt-get install smartmontools
sudo systemctl start smartd

일단 "df -h"로 디스크 상황을 조회하고 위와 같은 명령으로 smartmontools를 설치하고 서비스를 가동한다.

 

위의 그림처럼 "systemctl status smartd" 명령을 사용하면 서비스 상태를 확인할 수 있다.

 

"sudo smartctl -i /dev/sda1" 명령으로 위의 그림처럼 디스크의 세부 정보를 확인할 수 있다. 

 

ubuntu@ubuntu:~$ sudo smartctl -t short /dev/sda1
smartctl 6.6 2016-05-31 r4324 [i686-linux-4.15.0-213-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Wed Aug 23 17:31:24 2023

Use smartctl -X to abort test.

위의 내용은 "sudo smartctl -t short /dev/sda1" 명령으로 짧은 검사를 수행한 것으로 하단 메시지를 보면 2분 후에 검사가 끝날 거라고 말하고 있다. 긴 검사는 "sudo smartctl -t long /dev/sda1"로 수행할 수 있다.

 

ubuntu@ubuntu:~$ sudo smartctl -a /dev/sda1
smartctl 6.6 2016-05-31 r4324 [i686-linux-4.15.0-213-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar
Device Model:     WDC WD800BB-00JHC0
Serial Number:    WD-WMAM9HW12179
Firmware Version: 05.01C05
User Capacity:    80,026,361,856 bytes [80.0 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-6 (minor revision not indicated)
Local Time is:    Wed Aug 23 17:43:40 2023 KST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      ( 249) Self-test routine in progress...
                                        90% of test remaining.
Total time to complete Offline
data collection:                ( 2460) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        No General Purpose Logging support.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        (  35) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x003f) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0003   165   165   021    Pre-fail  Always       -       2708
  4 Start_Stop_Count        0x0032   099   099   000    Old_age   Always       -       1937
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   200   200   051    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   095   095   000    Old_age   Always       -       4141
 10 Spin_Retry_Count        0x0013   100   100   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0012   100   100   051    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       1925
194 Temperature_Celsius     0x0022   095   080   000    Old_age   Always       -       48
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0009   200   200   051    Pre-fail  Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      4141         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

 

앞서 수행한 테스트 결과는 시간이 지난 다음에 "sudo smartctl -a /dev/sda1" 명령을 수행하면 위의 그림처럼 결과 중에 "test log"에서 작업 결과와 오류 여부를 확인할 수 있다. 다양한 정보가 있으므로 참고한다.

 

 

 

 

728x90
댓글
최근에 올라온 글
최근에 달린 댓글
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함