mirror of
https://github.com/fankes/komari-agent.git
synced 2026-03-27 05:45:27 +08:00
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user