Akizon77
2026-03-10 15:55:04 +08:00
parent c829958d59
commit bb1e01459b

View File

@@ -83,26 +83,21 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
} }
mountpoint := strings.ToLower(part.Mountpoint) mountpoint := strings.ToLower(part.Mountpoint)
// 排除挂载点 // 排除挂载点
var mountpointsToExclude = []string{ var mountpointsToExcludePerfix = []string{
"/tmp", "/tmp",
"/var/tmp", "/var/tmp",
"/dev/shm", "/dev",
"/run", "/run",
"/run/lock",
"/run/user",
"/var/lib/containers", "/var/lib/containers",
"/var/lib/docker", "/var/lib/docker",
"/proc", "/proc",
"/dev/pts",
"/sys", "/sys",
"/sys/fs/cgroup", "/sys/fs/cgroup",
"/dev/mqueue",
"/etc/resolv.conf", "/etc/resolv.conf",
"/etc/host", // /etc/hosts,/etc/hostname "/etc/host", // /etc/hosts,/etc/hostname
"/dev/hugepages",
"/nix/store", "/nix/store",
} }
for _, mp := range mountpointsToExclude { for _, mp := range mountpointsToExcludePerfix {
if mountpoint == mp || strings.HasPrefix(mountpoint, mp) { if mountpoint == mp || strings.HasPrefix(mountpoint, mp) {
return false return false
} }
@@ -123,6 +118,7 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
var fstypeToExclude = []string{ var fstypeToExclude = []string{
"tmpfs", "tmpfs",
"devtmpfs", "devtmpfs",
"udev",
"nfs", "nfs",
"cifs", "cifs",
"smb", "smb",
@@ -136,6 +132,9 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
"cgroup", "cgroup",
"mqueue", "mqueue",
"hugetlbfs", "hugetlbfs",
"debugfs",
"binfmt_misc",
"securityfs",
} }
for _, fs := range fstypeToExclude { for _, fs := range fstypeToExclude {
if fstype == fs || strings.HasPrefix(fstype, fs) { if fstype == fs || strings.HasPrefix(fstype, fs) {