diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index f0a5f6f..2ff78e8 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -1788,13 +1788,15 @@ export default function Hardware() { {selectedDisk.rotation_rate !== undefined && selectedDisk.rotation_rate !== null && (
Rotation Rate - - {typeof selectedDisk.rotation_rate === "number" && selectedDisk.rotation_rate > 0 - ? `${selectedDisk.rotation_rate} rpm` - : typeof selectedDisk.rotation_rate === "string" - ? selectedDisk.rotation_rate - : "Solid State Device"} - +
+ {typeof selectedDisk.rotation_rate === "number" && selectedDisk.rotation_rate === -1 + ? "N/A" + : typeof selectedDisk.rotation_rate === "number" && selectedDisk.rotation_rate > 0 + ? `${selectedDisk.rotation_rate} rpm` + : typeof selectedDisk.rotation_rate === "string" + ? selectedDisk.rotation_rate + : "Solid State Device"} +
)} diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index e7263cc..7debfe6 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -211,6 +211,12 @@ export function StorageOverview() { if (diskName.startsWith("nvme")) { return "NVMe" } + // rotation_rate = -1 means HDD but RPM is unknown (detected via kernel rotational flag) + // rotation_rate = 0 or undefined means SSD + // rotation_rate > 0 means HDD with known RPM + if (rotationRate === -1) { + return "HDD" + } if (!rotationRate || rotationRate === 0) { return "SSD" } diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index 7533f0b..e3c9084 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -1387,6 +1387,26 @@ def get_smart_data(disk_name): smart_data['health'] = 'warning' # print(f"[v0] Health: WARNING (temperature {smart_data['temperature']}°C)") pass + + # CHANGE: Use -1 to indicate HDD with unknown RPM instead of inventing 7200 RPM + # Fallback: Check kernel's rotational flag if smartctl didn't provide rotation_rate + # This fixes detection for older disks that don't report RPM via smartctl + if smart_data['rotation_rate'] == 0: + try: + rotational_path = f"/sys/block/{disk_name}/queue/rotational" + if os.path.exists(rotational_path): + with open(rotational_path, 'r') as f: + rotational = int(f.read().strip()) + if rotational == 1: + # Disk is rotational (HDD), use -1 to indicate "HDD but RPM unknown" + smart_data['rotation_rate'] = -1 + # If rotational == 0, it's an SSD, keep rotation_rate as 0 + except Exception as e: + pass # If we can't read the file, leave rotation_rate as is + + except FileNotFoundError: + # print(f"[v0] ERROR: smartctl not found - install smartmontools for disk monitoring.") + pass except FileNotFoundError: # print(f"[v0] ERROR: smartctl not found - install smartmontools for disk monitoring.")