# Show wear level of SDcard + SSD (RPi)

**URL:** <https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370>\
**Category:** General\
**Created:** [27 November 2021 14:16 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370 "2021-11-27T14:16:13Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 14:16 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/1 "2021-11-27T14:16:13Z")

</div>

How do I get the value of the wear level of my:

- SSD and
- SDCard ?  
on Raspberry Pi?

_(I've seen someone a year ago on a dashboard to showing this value, but can not find where it was.)_

Would be important to auto-send a notification if it's lowering.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2021 14:33 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/2 "2021-11-27T14:33:43Z")

</div>

Generally I don't think you can, unless I am out of date. Some devices may have that in the SMART data, others don't, or it is not understandable if it is there. See [hard disk - How to check the life left in SSD or the medium's wear level? - Unix & Linux Stack Exchange](https://unix.stackexchange.com/questions/106678/how-to-check-the-life-left-in-ssd-or-the-mediums-wear-level)

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 14:58 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/3 "2021-11-27T14:58:08Z")

</div>

Your link had an important hint: `smartmontool`

Found this:

> **[Raspberry Pi - Festplatten-Gesundheitszustand mit S.M.A.R.T.-Tool...](https://strobelstefan.org/2021/04/11/raspberry-pi-festplatten-gesundheitszustand-mit-s-m-a-r-t-tool-smartmontools-ueberwachen/)**
>
> Das kleine Tool smartmontools bringt die S.M.A.R.T.-Funktion auf den Raspberry Pi und ermöglicht es euch den Gesundheitszustand der Festplatte regelmäßig und automatisiert abzufragen.

```auto
sudo apt install smartmontools

```

To check:

```auto
df 

```

This will list available devices. (I'm rather using an installed app: **gnome-disks** )

Now we can check SMART data:

```auto
sudo smartctl -i /dev/sda

```

And the result is:

```auto
smartctl 6.6 2017-11-05 r4594 [armv7l-linux-5.10.63-v7l+] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: ADATA SU800
Serial Number: 2I4420019349
LU WWN Device Id: 5 707c18 100700a9d
Firmware Version: R0427ANR
User Capacity: 128.035.676.160 bytes [128 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-3 T13/2161-D revision 5
SATA Version is: SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sat Nov 27 15:57:22 2021 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

```

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 15:16 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/4 "2021-11-27T15:16:36Z")

</div>

Sadly it can not read any infos from my SD card:

```auto
sudo smartctl --identify /dev/mmcblk0

```

Gives only:

```auto
/dev/mmcblk0: Unable to detect device type
Please specify device type with the -d option.

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2021 15:43 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/5 "2021-11-27T15:43:20Z")

</div>

And I don't think it tells you anything useful about the SSD either, does it?

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 15:48 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/6 "2021-11-27T15:48:28Z")

</div>

To get ALL Smart info about a device:

```auto
sudo smartctl --all /dev/sda

```

Gives:

```auto
smartctl 6.6 2017-11-05 r4594 [armv7l-linux-5.10.63-v7l+] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: ADATA SU800
Serial Number: 2I4420019349
LU WWN Device Id: 5 707c18 100700a9d
Firmware Version: R0427ANR
User Capacity: 128.035.676.160 bytes [128 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-3 T13/2161-D revision 5
SATA Version is: SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sat Nov 27 16:45:54 2021 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

General SMART Values:
Offline data collection status: (0x80)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Enabled.
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: (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: (0x0002)	Does not save 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: ( 30) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x0035)	SCT Status 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 0x0000 100 100 000 Old_age Offline - 0
  5 Reallocated_Sector_Ct 0x0000 100 100 000 Old_age Offline - 0
  9 Power_On_Hours 0x0000 100 100 000 Old_age Offline - 1027
 12 Power_Cycle_Count 0x0000 100 100 000 Old_age Offline - 118
148 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 329
149 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 41
150 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 3
151 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 21
159 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 0
160 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 0
161 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 33
163 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 24
164 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 11585
165 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 42
166 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 11
167 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 25
168 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 1500
169 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 99
177 Wear_Leveling_Count 0x0000 100 100 050 Old_age Offline - 0
181 Program_Fail_Cnt_Total 0x0000 100 100 000 Old_age Offline - 0
182 Erase_Fail_Count_Total 0x0000 100 100 000 Old_age Offline - 0
192 Power-Off_Retract_Count 0x0000 100 100 000 Old_age Offline - 60
194 Temperature_Celsius 0x0000 100 100 000 Old_age Offline - 37
195 Hardware_ECC_Recovered 0x0000 100 100 000 Old_age Offline - 0
196 Reallocated_Event_Count 0x0000 100 100 016 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0000 100 100 050 Old_age Offline - 0
232 Available_Reservd_Space 0x0000 100 100 000 Old_age Offline - 100
241 Total_LBAs_Written 0x0000 100 100 000 Old_age Offline - 22798
242 Total_LBAs_Read 0x0000 100 100 000 Old_age Offline - 19695
245 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 104265

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]

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 Completed [00% left] (0-65535)
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.

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2021 15:51 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/7 "2021-11-27T15:51:29Z")

</div>

But is any of that what you are looking for?

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [27 November 2021 15:57 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/8 "2021-11-27T15:57:59Z")

</div>

This is useful information .. especially the Read Errors, Reallocated Sectors and possibly the Power On hours.

can you use `--json` with that utility ?

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 15:58 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/9 "2021-11-27T15:58:02Z")

</div>

Yes of course !

```auto
Reallocated_Sector_Ct = 0
Wear_Leveling_Count = 0
Available_Reservd_Space = RAW 100
Temperature_Celsius = RAW 37

```

These 4 are the most important ones to watch.  
If `Wear_Leveling_Count` grows or  
`Available_Reservd_Space` reducing from 100 radically,  
than we have a big problem and need a popup warning or even voice alert.

If Temp \> 40 °C than most SSDs can damage much faster and usually fail if \>50 °C

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 15:59 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/10 "2021-11-27T15:59:26Z")

</div>

> [@UnborN](#):
>
> can you use `--json` with that utility ?

I don't think it will be necessary.  
There is an extensive documentation about how to use alllllll those parameters.  
I have the feeling it is possible to ask those important values one by one.

[https://www.smartmontools.org/browser/trunk/smartmontools/smartctl.8.in](https://www.smartmontools.org/browser/trunk/smartmontools/smartctl.8.in)

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [27 November 2021 16:04 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/11 "2021-11-27T16:04:51Z")

</div>

> [@PizzaProgram](#):
>
> I don't think it will be necessary.

are you planning to pass this information in node-red? .. thats why i was asking about json

[reading the link] nice .. its well documented

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 16:08 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/12 "2021-11-27T16:08:51Z")

</div>

> [@UnborN](#):
>
> are you planning to pass this information in node-red?

I've understood your question 🙂  
I don't know yet what will be the best method to analyse the text with Node-Red.  
I have not many experience yet how to convert some text to json with NR or node.js or javascript.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2021 16:10 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/13 "2021-11-27T16:10:02Z")

</div>

> [@PizzaProgram](#):
>
> If `Wear_Leveling_Count` grows

I thought wear levelling count started at 100 and went down.

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 16:11 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/14 "2021-11-27T16:11:22Z")

</div>

> [@Colin](#):
>
> I thought wear levelling count started at 100 and went down.

It depends on the brand of the SSD.  
[https://www.smartmontools.org/wiki/FAQ#TheSSD\_Life\_LeftAttributeofmynewSandForcebasedSSDreportszero](https://www.smartmontools.org/wiki/FAQ#TheSSD_Life_LeftAttributeofmynewSandForcebasedSSDreportszero)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2021 16:14 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/15 "2021-11-27T16:14:28Z")

</div>

> [@PizzaProgram](#):
>
> `Wear_Leveling_Count 0x0000 100`

Yours is showing 100 not 0, unless you are looking at the RAW field. I think it is generally best to look at the Value field, which should be normalised to give you a percentage still available.

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 16:29 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/16 "2021-11-27T16:29:05Z")

</div>

> [@Colin](#):
>
> look at the Value field

Most of the FAQ and doc on that page recommends that too.  
They are already pushing lot's of effort to deal with different manufacturer's calculations.  
_(It's a pity it is not standardized more generally.)_

But it will give wrong number, if you ask for an "optimised number" of a manufacturer it can not handle well.  
So I think NR node should give both 4 values and the user should decide what to do with those.

---

<div class="post-metadata">

**Author:** ![PizzaProgram](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pizzaprogram/32/19431_2.png) [@PizzaProgram](https://discourse.nodered.org/u/PizzaProgram)\
**Post date:** [27 November 2021 16:31 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/17 "2021-11-27T16:31:16Z")

</div>

# Help needed:

I'm still looking what type of controller is handling the SD card.

I think these controllers are supported:

> **[Supported\_RAID-Controllers – smartmontools](https://www.smartmontools.org/wiki/Supported_RAID-Controllers)**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 January 2022 16:31 UTC](https://discourse.nodered.org/t/show-wear-level-of-sdcard-ssd-rpi/54370/18 "2022-01-26T16:31:35Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
