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