디스크 드라이브에서 제공하는 SMART 값들을 조회하기 위해 "smartmontools"를 설치한다. brew package manager를 사용하면 편하다.
$ brew install smartmontools
다음에는 "df -h /" 을 입력한다. 디스크가 /dev에서 disk0인지 disk1인지 몰라서 조회해봄. disk1 임을 알 수 있음.
$ df -h /
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1s5 233Gi 11Gi 116Gi 9% 488454 2447612866 0% /
11Gi 밖에 사용하지 않았다고 하는데 운영체제와 유저 공간이 논리적으로 분리되어 있어서 그렇다. 실제로는 233Gi-116Gi = 117GiB 정도 점유하고 있음.
$ sudo smartctl -a /dev/disk1
Password: <자기 mac password>
smartctl 7.1 2019-12-30 r5022 [Darwin 19.6.0 x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Number: APPLE SSD AP0256N
Serial Number: // REDACTED //
Firmware Version: 717.120.
PCI Vendor/Subsystem ID: 0x106b
IEEE OUI Identifier: 0x000000
Controller ID: 0
Number of Namespaces: 1
Local Time is: Fri Oct 9 14:57:48 2020 PDT
Firmware Updates (0x02): 1 Slot
Optional Admin Commands (0x0004): Frmw_DL
Optional NVM Commands (0x0004): DS_Mngmt
Maximum Data Transfer Size: 256 Pages
Supported Power States
St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat
0 + 0.00W - - 0 0 0 0 0 0
=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 38 Celsius
Available Spare: 100%
Available Spare Threshold: 99%
Percentage Used: 0%
Data Units Read: 8,709,837 [4.45 TB]
Data Units Written: 12,288,783 [6.29 TB]
Host Read Commands: 181,693,228
Host Write Commands: 454,650,517
Controller Busy Time: 0
Power Cycles: 84
Power On Hours: 357
Unsafe Shutdowns: 14
Media and Data Integrity Errors: 0
Error Information Log Entries: 0
Read Error Information Log failed: NVMe admin command:0x02/page:0x01 is not supported
Data Units Read는 크게 볼 필요 없고 (Read에는 수명을 고려하지 않아도 되니) Data Units Written을 보면 6.29 TB를 디스크에 "누적"으로 썼음을 알 수 있다. 전반적인 수명 상태는 Available Spare나 Available Spare Threshold 둘 중에 어떤 것을 봐야 할지는 모르겠다. 99% 아래로 내려가는 순간이 되면 알게 되겠지...
다른 맥 (이거는 구형 모델이라 내가 아무 SSD나 갖다가 끼운 거. 제조사는 Sandisk)의 출력 결과:
SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0032 100 100 --- Old_age Always - 0
9 Power_On_Hours 0x0032 253 100 --- Old_age Always - 13567
12 Power_Cycle_Count 0x0032 100 100 --- Old_age Always - 3652
166 Min_W/E_Cycle 0x0032 100 100 --- Old_age Always - 1
167 Min_Bad_Block/Die 0x0032 100 100 --- Old_age Always - 15
168 Maximum_Erase_Cycle 0x0032 100 100 --- Old_age Always - 460
169 Total_Bad_Block 0x0032 100 100 --- Old_age Always - 142
171 Program_Fail_Count 0x0032 100 100 --- Old_age Always - 0
172 Erase_Fail_Count 0x0032 100 100 --- Old_age Always - 0
173 Avg_Write/Erase_Count 0x0032 100 100 --- Old_age Always - 339
174 Unexpect_Power_Loss_Ct 0x0032 100 100 --- Old_age Always - 47
187 Reported_Uncorrect 0x0032 100 100 --- Old_age Always - 0
194 Temperature_Celsius 0x0022 075 043 --- Old_age Always - 25 (Min/Max 13/43)
212 SATA_PHY_Error 0x0032 100 100 --- Old_age Always - 0
230 Perc_Write/Erase_Count 0x0032 100 100 --- Old_age Always - 0 0 2846
232 Perc_Avail_Resrvd_Space 0x0033 100 100 004 Pre-fail Always - 100
233 Total_NAND_Writes_GiB 0x0032 100 100 --- Old_age Always - 44326
241 Total_Writes_GiB 0x0030 253 253 --- Old_age Offline - 5273
242 Total_Reads_GiB 0x0030 253 253 --- Old_age Offline - 1959
243 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
173번 항목 (Avg_Write/Erase_Count) 을 보면 셀당 339회 썼음을 알 수 있고, 233번 항목 (Total_NAND_Writes_GiB) 항목을 보면 44.326TB 를 디스크에 썼다. 호스트에서는 5.273TB에 불과한데 9배나 증폭된 것은 의외? 자잘한 파일들을 다뤘다는 의미일까.
요즘에는 SSD 가격이 많이 떨어져서 그렇게 신경은 안 쓰는데, 되도록 SSD 장비들은 언제든지 데이터가 날아갈 수 있다고 생각하는 것이 좋다. SSD는 디스크가 날아가게 되면 복구할 수 있는 확률이 거의 없는 듯.