From ef34c64097116939c40724a35bc5fb4025440e64 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 19 Sep 2024 15:50:21 +0200 Subject: [statistics] Ignore HDDS (block devices) that are too small --- modules-available/statistics/inc/hardwareparser.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules-available') diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index 428f7d55..fb8060e8 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -515,6 +515,8 @@ class HardwareParser $smart['rotation_rate'] = 0; } $size = $lsblk['size'] ?? $smart['user_capacity']['bytes'] ?? -1; + if ($size !== -1 && $size < 256000000) + continue; // Ignore too small // Don't change the global props, it would change the HW ID $hwid = self::writeGlobalHardwareData(HardwareInfo::HDD, [ // Try to use the model name as the unique identifier @@ -614,7 +616,7 @@ class HardwareParser ++$i; } } - $table['unused'] = $size - $used; + $table['unused'] = max(0, $size - $used); $table['dev'] = $dev['readlink']; $table += self::propsFromArray($smart + $lsblk, 'serial_number', 'firmware_version', -- cgit v1.2.3-55-g7522