diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2025-09-12 22:32:35 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2025-09-12 22:32:35 -0500 |
| commit | b25890097e7dfaa2d7a4dbf703f289a74720452c (patch) | |
| tree | b7f074cd0ce43b14d801a88f682dc3c273c00359 /misc/diskhealth | |
| parent | 1c8ea36d4104089d5f45f23047ee1b95868a3e92 (diff) | |
| download | scripts-b25890097e7dfaa2d7a4dbf703f289a74720452c.tar.xz scripts-b25890097e7dfaa2d7a4dbf703f289a74720452c.zip | |
remove diskhealth script for qdiskinfo instead
Diffstat (limited to 'misc/diskhealth')
| -rwxr-xr-x | misc/diskhealth | 46 |
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) |
