public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: piknew <mparka@wp.pl>
To: pve-devel@lists.proxmox.com
Subject: [PATCH] fix #7551: smartctl: negative values are reported for SSD wear level
Date: Fri, 23 Oct 2026 21:51:04 +0100	[thread overview]
Message-ID: <41511f31-adcf-4b25-9d1d-c5ff3d5f5be2@PKPC.local> (raw)

Signed-off-by: piknew <mparka@wp.pl>
---
 src/PVE/Diskmanage.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index d9ce0d0..2d01803 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -451,6 +451,13 @@ sub get_wear_leveling_info {
         foreach my $attr (@$attributes) {
             next if $attr->{name} !~ m/$register/;
             $wearout = $attr->{value};
+            # As of https://bugzilla.proxmox.com/show_bug.cgi?id=7551
+            # Some SSDs (Crucial MX500 for example) are reporting wearout over 100%
+            # This is directly reflected in "raw".
+            # When using "value" (wrapped a 8-bit unsigned integer), it shall be normalized.
+            # Example:
+            # 101% -> value=255, 102% -> value=254, 103% -> value=253
+            $wearout = $wearout - 256 if($wearout > 100);
             last;
         }
     }
-- 
2.43.0.windows.1





                 reply	other threads:[~2026-10-27  9:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41511f31-adcf-4b25-9d1d-c5ff3d5f5be2@PKPC.local \
    --to=mparka@wp.pl \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal