From 2aff976c76d52a36d9084b23337c88c85ef5c009 Mon Sep 17 00:00:00 2001 From: brent saner Date: Tue, 7 Oct 2025 15:52:49 -0400 Subject: [PATCH] Fixes #1932 Certain virtual filesystems (e.g. nsfs, SOME tmpfs, overlayfs, etc.) should NOT duplicate the fstype as the source, as they have a *real* source. This PR applies logic to determine whether to use mountinfo field 10 as the device ('source') or to use the mouninfo field 3 ('root') as the device. --- disk/disk_linux.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/disk/disk_linux.go b/disk/disk_linux.go index 8c4803338c..029e7fc578 100644 --- a/disk/disk_linux.go +++ b/disk/disk_linux.go @@ -341,6 +341,7 @@ func parseFieldsOnMountinfo(ctx context.Context, lines []string, all bool, fs [] blockDeviceID := fields[2] mountPoint := fields[4] mountOpts := strings.Split(fields[5], ",") + device := fields[3] if rootDir := fields[3]; rootDir != "" && rootDir != "/" { mountOpts = append(mountOpts, "bind") @@ -348,7 +349,9 @@ func parseFieldsOnMountinfo(ctx context.Context, lines []string, all bool, fs [] fields = strings.Fields(parts[1]) fstype := fields[0] - device := fields[1] + if (fields[0] != fields[1]) || (fields[0] == fields[1] && device == "/") { + device = fields[1] + } d := PartitionStat{ Device: device,