马春杰杰 Exit Reader Mode

如何查看固态硬盘的使用寿命和使用时长

首先安装homebrew,不知道怎么安装的见:

homebrew就类似ubuntu里的apt,装软件贼好使。

安装之后,再安装一个小工具:

brew install smartmontools

然后打开终端,查看一下SSD设备标签代码

(py3) dln@dulinadeMacBook-Pro ~ % diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         1.0 TB     disk0
   1:             Apple_APFS_ISC ⁨⁩                        524.3 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk3⁩         994.7 GB   disk0s2
   3:        Apple_APFS_Recovery ⁨⁩                        5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +994.7 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - Data⁩     94.3 GB    disk3s1
   2:                APFS Volume ⁨Macintosh HD⁩            15.2 GB    disk3s3
   3:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.2 GB    disk3s3s1
   4:                APFS Volume ⁨Preboot⁩                 394.4 MB   disk3s4
   5:                APFS Volume ⁨Recovery⁩                860.5 MB   disk3s5
   6:                APFS Volume ⁨VM⁩                      1.1 GB     disk3s6

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *512.1 GB   disk4
   1:               Windows_NTFS ⁨ExFAT⁩                   136.3 GB   disk4s1
   2:                       0xEF ⁨⁩                        33.6 MB    disk4s2
   3:             Windows_FAT_32 ⁨FAT32⁩                   53.7 GB    disk4s3
   4:               Windows_NTFS ⁨NTFS⁩                    322.1 GB   disk4s4

这里的disk0disk3都是同一个。然后运行smartctl -a disk0即可。

(py3) dln@dulinadeMacBook-Pro ~ % smartctl -a disk0  
smartctl 7.3 2022-02-28 r5338 [Darwin 21.4.0 arm64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       APPLE SSD AP1024Q
Serial Number:                      0ba0148a02c93627
Firmware Version:                   387.100.
PCI Vendor/Subsystem ID:            0x106b
IEEE OUI Identifier:                0x000000
Controller ID:                      0
NVMe Version:                       <1.2
Number of Namespaces:               3
Local Time is:                      Mon May  9 15:07:05 2022 CST
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:                        34 Celsius
Available Spare:                    100%
Available Spare Threshold:          99%
Percentage Used:                    0%
Data Units Read:                    3,649,838 [1.86 TB]
Data Units Written:                 6,198,646 [3.17 TB]
Host Read Commands:                 51,781,694
Host Write Commands:                155,784,430
Controller Busy Time:               0
Power Cycles:                       141
Power On Hours:                     29
Unsafe Shutdowns:                   13
Media and Data Integrity Errors:    0
Error Information Log Entries:      0

Read 1 entries from Error Information Log failed: GetLogPage failed: system=0x38, sub=0x0, code=745

可以看到,目前已经使用29小时,寿命(Percentage Used)还剩100%

关于其他的信息,可以参考这个:

严重警告(Critical Warning):会显示控制器状态警告讯息,如果都显示0x00 就表示没事

温度(Temperature):会显示当前SSD 温度资讯

可用备用空间(Available Spare):SSD 剩余空间百分比

可用备用临界值(Available Spare Threshold):临界值全由厂商定义

寿命百分比(Percentage Used):目前SSD 寿命百分比数值,具体取决于实际设备使用情况和厂商对设备寿命的预测。

资料读取(Data Units Read):记录电脑从SSD读取512字节数据单元的总量,每1000个单元记录一次,即这项Raw数据1的值等于500KB。

资料写入(Data Units Read):如上,就是写入总量。

主机读取命令(Host Read Commands):主控收到的读取命令数量。

主机写入命令(Host Write Commands):主控收到的写入命令数量。

控制器忙碌时间(Controller Busy Time):主控忙于I/O命令的时间。

意外关机(Unsafe Shutdowns):纪录不正常断电次数

媒体和资料完整性错误(Media and Data Integrity Errors):主控检测得到的未恢复的数据完整性错误次数。

错误资料纪录(Number of Error Information Log Entries):主控总共收到的错误信息日志数量。

iMac:2022年11月04日22:11:08数据:

iMac:2022年12月08日15:32:56数据

=== START OF INFORMATION SECTION ===
Model Number:                       WDS100T3X0C-00SJG0
Serial Number:                      2012A3443007
Firmware Version:                   111110WD
PCI Vendor/Subsystem ID:            0x15b7
IEEE OUI Identifier:                0x001b44
Total NVM Capacity:                 1,000,204,886,016 [1.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      8215
Number of Namespaces:               1
Local Time is:                      Thu Dec  8 15:31:09 2022 CST
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     84 Celsius
Critical Comp. Temp. Threshold:     88 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     6.00W       -        -    0  0  0  0        0       0
 1 +     3.50W       -        -    1  1  1  1        0       0
 2 +     3.00W       -        -    2  2  2  2        0       0
 3 -   0.1000W       -        -    3  3  3  3     4000   10000
 4 -   0.0025W       -        -    4  4  4  4     4000   40000

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

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        44 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    16%
Data Units Read:                    1,686,737,816 [863 TB]
Data Units Written:                 531,768,320 [272 TB]
Host Read Commands:                 147,148,806,708
Host Write Commands:                4,712,048,884
Controller Busy Time:               68,560
Power Cycles:                       152
Power On Hours:                     18,412
Unsafe Shutdowns:                   106
Media and Data Integrity Errors:    0
Error Information Log Entries:      1
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0

Read Error Information Log failed: NVMe admin command:0x02/page:0x01 is not supported

MBP:2022年12月24日21:46:03

# mcj @ machunjiedeMacBook-Pro in ~ [21:44:37] 
$ smartctl -a disk0
smartctl 7.3 2022-02-28 r5338 [Darwin 21.6.0 x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Apple SD/SM/TS...E/F/G SSDs
Device Model:     APPLE SSD SM0512G
Serial Number:    S2ZCNY0K502289
LU WWN Device Id: 5 002538 900000000
Firmware Version: BXZ13A0Q
User Capacity:    500,277,790,720 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
TRIM Command:     Available
Device is:        In smartctl database 7.3/5319
ATA Version is:   ATA8-ACS T13/1699-D revision 4c
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Dec 24 21:44:46 2022 CST
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:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(    0) seconds.
Offline data collection
capabilities: 			 (0x53) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					No Offline surface scan supported.
					Self-test supported.
					No 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.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 (  10) minutes.

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
  1 Raw_Read_Error_Rate     0x001a   200   200   000    Old_age   Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   000    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       5988
 12 Power_Cycle_Count       0x0032   095   095   000    Old_age   Always       -       5048
169 Unknown_Apple_Attrib    0x0013   253   253   010    Pre-fail  Always       -       3161246926720
173 Wear_Leveling_Count     0x0032   192   192   100    Old_age   Always       -       201880699003
174 Host_Reads_MiB          0x0022   099   099   000    Old_age   Always       -       30138881(28.74T)
175 Host_Writes_MiB         0x0022   099   099   000    Old_age   Always       -       36156261(34.48T)
192 Power-Off_Retract_Count 0x0012   099   099   000    Old_age   Always       -       145
194 Temperature_Celsius     0x0022   058   023   000    Old_age   Always       -       42 (Min/Max 11/77)
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

Warning! SMART Selective Self-Test Log Structure error: invalid SMART checksum.
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
  255        0    65535  Read_scanning was never started
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.

MBP:2023年12月03日20:57:29

smartctl 7.3 2022-02-28 r5338 [Darwin 21.6.0 x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       Samsung SSD 970 EVO Plus 2TB
Serial Number:                      S6P1NS0W321812V
Firmware Version:                   4B2QEXM7
PCI Vendor/Subsystem ID:            0x144d
IEEE OUI Identifier:                0x002538
Total NVM Capacity:                 2,000,398,934,016 [2.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      6
NVMe Version:                       1.3
Number of Namespaces:               1
Local Time is:                      Sun Dec  3 20:57:47 2023 CST
Firmware Updates (0x16):            3 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x0057):     Comp Wr_Unc DS_Mngmt Sav/Sel_Feat Timestmp
Log Page Attributes (0x0f):         S/H_per_NS Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     82 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     7.59W       -        -    0  0  0  0        0       0
 1 +     7.59W       -        -    1  1  1  1        0     200
 2 +     7.59W       -        -    2  2  2  2        0    1000
 3 -   0.0500W       -        -    3  3  3  3     2000    1200
 4 -   0.0050W       -        -    4  4  4  4      500    9500

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

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        37 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    1%
Data Units Read:                    50,664,415 [25.9 TB]
Data Units Written:                 110,139,560 [56.3 TB]
Host Read Commands:                 761,217,028
Host Write Commands:                2,129,958,038
Controller Busy Time:               6,452
Power Cycles:                       1,503
Power On Hours:                     2,499
Unsafe Shutdowns:                   4
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               37 Celsius
Temperature Sensor 2:               58 Celsius

Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

M1MAX 2024年02月29日09:40:51

# mcj @ M1_Max in ~ [9:36:12] 
$ smartctl -a disk0
smartctl 7.4 2023-08-01 r5530 [Darwin 22.6.0 arm64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       APPLE SSD AP4096R
Serial Number:                      0ba01801445c7a1e
Firmware Version:                   359.60.3
PCI Vendor/Subsystem ID:            0x106b
IEEE OUI Identifier:                0x000000
Controller ID:                      0
NVMe Version:                       <1.2
Number of Namespaces:               3
Local Time is:                      Thu Feb 29 09:37:15 2024 CST
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:                        30 Celsius
Available Spare:                    100%
Available Spare Threshold:          99%
Percentage Used:                    0%
Data Units Read:                    60,110,359 [30.7 TB]
Data Units Written:                 42,865,349 [21.9 TB]
Host Read Commands:                 1,503,311,873
Host Write Commands:                727,253,707
Controller Busy Time:               0
Power Cycles:                       385
Power On Hours:                     606
Unsafe Shutdowns:                   29
Media and Data Integrity Errors:    0
Error Information Log Entries:      0

Read 1 entries from Error Information Log failed: GetLogPage failed: system=0x38, sub=0x0, code=745