ZEROST's Blog

Ubuntu Linux 5.4.0-1056-raspi 버전 기준(Rasberry Pi OS 기준)

Smartmontools 이라는 패키지를 설치해야 현재 하드디스크 온도를 확인 할 수 있다. 패키지를 설치한다.

$ sudo apt install smartmontools

설치후에 실행을 해본다.

$ sudo smartctl -A /dev/sda

결과가 아래와 같이 출력된다.

$ sudo smartctl -A /dev/sda
smartctl 7.1 2019-12-30 r5022 [aarch64-linux-5.4.0-1056-raspi] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
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     0x000b   100   100   016    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0004   128   128   054    Old_age   Offline      -       108
  3 Spin_Up_Time            0x0007   154   154   024    Pre-fail  Always       -       528 (Average 527)
  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       1473
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000a   100   100   067    Old_age   Always       -       0
  8 Seek_Time_Performance   0x0004   128   128   020    Old_age   Offline      -       18
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       1036
 10 Spin_Retry_Count        0x0012   100   100   060    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       47
192 Power-Off_Retract_Count 0x0032   099   099   000    Old_age   Always       -       1520
193 Load_Cycle_Count        0x0012   099   099   000    Old_age   Always       -       1520
194 Temperature_Celsius     0x0002   151   151   000    Old_age   Always       -       43 (Min/Max 14/56)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       17

ID 194번 Temperature_Celsius이 현재 하드디스크 온도이다.

194 Temperature_Celsius     0x0002   151   151   000    Old_age   Always       -       43 (Min/Max 14/56)

현재 내 라즈베리파이에 연결된 하드디스크 온도는 43도이다. 온도만 출력 되도록 보완해서 온도만 출력 하겠다.

sudo smartctl -A /dev/sda | grep Temperature_Celsius | awk '{print $10 " °C"}'
45 °C

현재 하드디스크 온도만 직관적으로 잘 출력된다.