PhysicalDisk (Windows): adds SMART failing status for ATA disks
Ref: #2726
This commit is contained in:
1 parent
9153929d2a
commit
3bd01e5abc
2 files changed
+27
-1
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ Features:
|
||||
* Added opt-in drive health detection for NVMe disks, via udisks2 on Linux (no root required), NVMe SMART on macOS and the NVMe health log on Windows. (#2726, PhysicalDisk, Linux / macOS / Windows)
|
||||
* Enable it with `"health": true`. The default output appends `Health <100 - percentage used>%` and any critical warnings.
|
||||
* New format args: `{health}`, `{percent-used}`, `{available-spare}` and `{critical-warning}`.
|
||||
* On Linux, ATA disks report the SMART `failing` status as a critical warning.
|
||||
* On Linux and Windows, ATA disks report the SMART `failing` status as a critical warning.
|
||||
|
||||
Changes:
|
||||
* Improved PCI GPU name resolution by checking udev's hardware database and the NVIDIA driver's procfs before falling back to pci.ids. (GPU, Linux)
|
||||
|
||||
@@ -340,6 +340,32 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
}
|
||||
}
|
||||
|
||||
if (options->health && sdd && !(device->type & FF_PHYSICALDISK_TYPE_VIRTUAL) && (sdd->BusType == BusTypeAta || sdd->BusType == BusTypeSata)) {
|
||||
STORAGE_PREDICT_FAILURE spf = {};
|
||||
if (DeviceIoControl(
|
||||
hDevice,
|
||||
IOCTL_STORAGE_PREDICT_FAILURE,
|
||||
nullptr,
|
||||
0,
|
||||
&spf,
|
||||
sizeof(spf),
|
||||
&retSize,
|
||||
nullptr)) {
|
||||
if (retSize >= sizeof(spf)) {
|
||||
if (device->criticalWarning == FF_PHYSICALDISK_WARNING_UNSET) {
|
||||
device->criticalWarning = FF_PHYSICALDISK_WARNING_NONE;
|
||||
}
|
||||
if (spf.PredictFailure) {
|
||||
device->criticalWarning |= FF_PHYSICALDISK_WARNING_FAILING;
|
||||
}
|
||||
} else {
|
||||
FF_DEBUG("ATA failure prediction reply too short: %u bytes", (unsigned) retSize);
|
||||
}
|
||||
} else {
|
||||
FF_DEBUG("Failed to query ATA failure prediction: %s", ffDebugWin32Error(GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user