mirror of
https://github.com/systemd/systemd.git
synced 2026-11-07 13:57:10 +00:00
This adds systemd-report-diskhealth, which reports the key health parameters of NVMe and ATA disks, plus basic identity information about all disks. For all hardware backed disks (including USB ones) size, logical and physical sector size are reported from sysfs, and model, vendor and serial from the udev database, preferring hwdb data, and falling back to the PCI or USB device if the block device itself carries no model/vendor information. For NVMe disks the SMART / Health Information log page is read via the NVMe admin command ioctl, and the critical warning bitmask, available spare, percentage used and media error counter are reported. For ATA disks with SMART enabled the overall SMART status is read via SG_IO ATA pass-through, and for rotating ones also the reallocated, pending and offline uncorrectable sector counts (SMART attributes 5, 197, 198), since various SSD vendors reused these attributes with incompatible semantics. Power-on hours and power cycle counts are reported for both under a common metric name, for ATA disks taken from the standardized Device Statistics log rather than from the vendor specific SMART attributes. ATA disks in standby are not queried, in order not to spin them up, and neither are ATA disks behind USB bridges. The temperature is deliberately not reported, since systemd-report-hwmon covers that already.