summaryrefslogtreecommitdiff
path: root/misc/diskhealth
diff options
context:
space:
mode:
Diffstat (limited to 'misc/diskhealth')
-rwxr-xr-xmisc/diskhealth46
1 files changed, 0 insertions, 46 deletions
diff --git a/misc/diskhealth b/misc/diskhealth
deleted file mode 100755
index 5cce07b..0000000
--- a/misc/diskhealth
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python3
-
-import subprocess
-import json
-from pprint import pprint
-
-smart_result = subprocess.run(["sudo", "smartctl", "-Aij", "/dev/sda"], capture_output=True, text=True)
-
-smart_result = json.loads(smart_result.stdout)
-
-sector_size = smart_result["logical_block_size"]
-
-from typing import NamedTuple
-class RawValue(NamedTuple):
- value: int
- string: str
-
-class Flags(NamedTuple):
- value: int
- string: str
- prefailure: bool
- updated_online: bool
- performance: bool
- error_rate: bool
- event_count: bool
- auto_keep: bool
-
-class SmartAttribute(NamedTuple):
- id: int
- name: str
- value: int
- worst: int
- thresh: int
- when_failed: str
- flags: dict
- raw: dict
-
-attributes = {}
-
-for attr in smart_result["ata_smart_attributes"]["table"]:
- attr_l = SmartAttribute(**attr)
- attributes[attr_l.id] = attr_l
-
-if 241 in attributes:
- lbas_written = attributes[241].raw["value"]
- print((lbas_written * sector_size) / 10**12)