[pbs-devel] [PATCH proxmox-backup] tools: smart: only throw error for smartctl fatal errors

Dominik Csapak d.csapak at proxmox.com
Tue Aug 31 15:48:25 CEST 2021


only bit 0-2 are fatal errors, bit 3-7 are used to indicate
some drive conditions. for details see the manpage of smartctl(8)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
reported in the forum: https://forum.proxmox.com/threads/s-m-a-r-t-status-unknown.95417/

 src/tools/disks/smart.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/tools/disks/smart.rs b/src/tools/disks/smart.rs
index b615603e..01054519 100644
--- a/src/tools/disks/smart.rs
+++ b/src/tools/disks/smart.rs
@@ -91,7 +91,9 @@ pub fn get_smart_data(
     };
     command.arg(disk_path);
 
-    let output = crate::tools::run_command(command, None)?;
+    let output = crate::tools::run_command(command, Some(|exitcode|
+        (exitcode & 0b0111) == 0 // only bits 0-2 are fatal errors
+    ))?;
 
     let output: serde_json::Value = output.parse()?;
 
-- 
2.30.2






More information about the pbs-devel mailing list