Skip to content

Commit

Permalink
ADD: Percent_Lifetime_Remain wear level indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
reefland committed Jul 18, 2023
1 parent ced1f8d commit 04b4fb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions 36-diskstatus
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# AUTHOR : Richard J. DURSO
# DATE : 07/18/2023
# VERSION : 1.11
# VERSION : 1.12
##############################################################################

set -eu
Expand Down Expand Up @@ -159,8 +159,9 @@ for i in "${!disksalias[@]}"; do #for every /dev/sdX device name
result=$(echo "${lines}" | awk -v a="${name}" '$0 ~ a {print $(NF-1),$NF; exit 1 }')
if [ $? -eq 1 ]; then
set -e
# SATA SSDs have a Wear_Leveling_Count that goes from 100 to 0, if detected report as percent left
percent_left=$(smartctl -a "/dev/${disksalias[$i]}" | awk '/Wear_Leveling_Count/{print $4}')
# SATA SSDs have a Wear_Leveling_Count or Percent_Lifetime_Remain that goes from 100 to 0 in column "VALUE" (4th column)
# if detected report as percent left
percent_left=$(smartctl -a "/dev/${disksalias[$i]}" | awk '/(Wear_Leveling_Count|Percent_Lifetime_Remain)/{print $4}')
if [[ -n ${percent_left} ]]; then
# Base10 to Base10 conversion to remove any leading zeros
percent_left=$(( 10#"${percent_left}" ))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ disk status:

#### Wear Level Indicator

SATA SSD and NVMe devices which report a detectable wear level indicator or a life expectancy indicator, will be expressed as a percentage that starts at 100% and decreases towards 0%.
SATA SSD and NVMe devices which report a detectable wear level indicator or a life expectancy indicator, will be expressed as a percentage that starts at 100% and decreases towards 0%. `smartctl` attribute names evaluated: `Wear_Leveling_Count` and `Percent_Lifetime_Remain`, NVMe attribute `percentage_used`.

The indicator will remain green until it drops below 30%, it will then be yellow to get your attention. Below 15% will turn red. The device should be replaced.

Expand Down

0 comments on commit 04b4fb2

Please sign in to comment.