Skip to content

Commit 34b7093

Browse files
committed
fix(disk): Enhance partition filtering logic to include ZFS filesystems #55
Signed-off-by: Mert Şişmanoğlu <[email protected]>
1 parent fd553ff commit 34b7093

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/metric/disk.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ func CollectDiskMetrics() (MetricsSlice, []CustomErr) {
4040
}
4141

4242
for _, p := range partitions {
43-
// Filter out partitions that are already checked or not a device
44-
// Also, exclude '/dev/loop' devices to avoid unnecessary partitions
45-
// * /dev/loop devices are used for mounting snap packages
46-
if slices.Contains(checkedSlice, p.Device) || !strings.HasPrefix(p.Device, "/dev") || strings.HasPrefix(p.Device, "/dev/loop") {
43+
// Filter out partitions that are already checked or loop devices
44+
// Include both /dev devices (except loops) and ZFS filesystems
45+
// * ZFS filesystems are not prefixed with /dev, so we check for that separately
46+
if slices.Contains(checkedSlice, p.Device) ||
47+
(strings.Contains(p.Device, "/dev/loop") || (!strings.HasPrefix(p.Device, "/dev") && p.Fstype != "zfs")) {
4748
continue
4849
}
4950

0 commit comments

Comments
 (0)