How to determine number of write cycles or expected life for SSD under Linux?
Solution 1:
Intel SSDs do keep statistics on total writes and how far through it's likely lifespan it is.
The following is from an Intel X25-M G2 160GB (SSDSA2M160G2GC)
# smartctl -data -A /dev/sda
smartctl 5.40 2010-10-16 r3189 [x86_64-redhat-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 5
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
3 Spin_Up_Time 0x0020 100 100 000 Old_age Offline - 0
4 Start_Stop_Count 0x0030 100 100 000 Old_age Offline - 0
5 Reallocated_Sector_Ct 0x0032 100 100 000 Old_age Always - 1
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 6855
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 68
192 Unsafe_Shutdown_Count 0x0032 100 100 000 Old_age Always - 30
225 Host_Writes_32MiB 0x0030 200 200 000 Old_age Offline - 148487
226 Workld_Media_Wear_Indic 0x0032 100 100 000 Old_age Always - 3168
227 Workld_Host_Reads_Perc 0x0032 100 100 000 Old_age Always - 1
228 Workload_Minutes 0x0032 100 100 000 Old_age Always - 1950295543
232 Available_Reservd_Space 0x0033 099 099 010 Pre-fail Always - 0
233 Media_Wearout_Indicator 0x0032 098 098 000 Old_age Always - 0
184 End-to-End_Error 0x0033 100 100 099 Pre-fail Always - 0
The Host_Writes_32MIB raw value shows how many 32MiB units of data have been written to this drive.
The Media_Wearout_Indicator value shows you a normalised percentage of how far through its useful wear-lifespan the drive is. This starts at 100 (or 099, I forget which), and proceeds down to 001, at which point Intel consider the drive to have exceeded its useful life. Intel use the MWI as part of warranty claims too - once the MWI reaches 001, the warranty is expired.
The MWI reaching 001 does not mean the drive will fail immediately however! Intel will have tolerance built in to deal with variances in flash units. I've seen drives last well past this point, and I'm actively wear-testing some Intel 320 series SSDs to see how much longer they last.
However, as the warranty expires when the MWI reaches 001, I'd replace any drives at that point.
Solution 2:
Corsair drives also export a similar percentage-life-left indicator. In their case it is attribute 231:
231 SSD_Life_Left 0x0013 100 100 010 Pre-fail Always - 0
(Note that if smartctl is displaying this as a Temperature you need to update your device database. On my Debian system that means running /usr/sbin/update-smart-drivedb
)
A Corsair blog post seems to show that the value never goes below 10% so I presume it should be replaced at 10%.
I also have an OCZ drive with the same Sandforce controller which also exports the same SSD_Life_Left value.
Solution 3:
The Media_Wearout_Indicator is what you are looking for. For 100 means your ssd has 100% life, the lower number means less life left.
# smartctl -a /dev/sda | grep Media_Wearout_Indicator
Output from my laptop
233 Media_Wearout_Indicator 0×0032 100 100 000 Old_age Always – 0
If you want to see more details and full attributes from your drive, you can run
# smartctl -data -A /dev/sda
and the output
# smartctl -data -A /dev/sda
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-49-generic] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0×0032 100 100 000 Old_age Always – 0
9 Power_On_Hours 0×0032 000 000 000 Old_age Always – 232959027031342
12 Power_Cycle_Count 0×0032 100 100 000 Old_age Always – 279
170 Unknown_Attribute 0×0033 100 100 010 Pre-fail Always – 0
171 Unknown_Attribute 0×0032 100 100 000 Old_age Always – 0
172 Unknown_Attribute 0×0032 100 100 000 Old_age Always – 0
174 Unknown_Attribute 0×0032 100 100 000 Old_age Always – 278
184 End-to-End_Error 0×0033 100 100 090 Pre-fail Always – 0
187 Reported_Uncorrect 0×0032 100 100 000 Old_age Always – 0
192 Power-Off_Retract_Count 0×0032 100 100 000 Old_age Always – 278
225 Load_Cycle_Count 0×0032 100 100 000 Old_age Always – 10752
226 Load-in_Time 0×0032 100 100 000 Old_age Always – 65535
227 Torq-amp_Count 0×0032 100 100 000 Old_age Always – 66
228 Power-off_Retract_Count 0×0032 100 100 000 Old_age Always – 65535
232 Available_Reservd_Space 0×0033 100 100 010 Pre-fail Always – 0
233 Media_Wearout_Indicator 0×0032 100 100 000 Old_age Always – 0
241 Total_LBAs_Written 0×0032 100 100 000 Old_age Always – 10752
242 Total_LBAs_Read 0×0032 100 100 000 Old_age Always – 21803
249 Unknown_Attribute 0×0013 100 100 000 Pre-fail Always – 357
http://namhuy.net/1024/how-to-check-ssd-life-left.html