Tighten disk safety checks

This commit is contained in:
2026-04-24 07:18:17 +03:00
parent b8eabee393
commit 75c6b928ae
5 changed files with 92 additions and 8 deletions

View File

@@ -135,6 +135,9 @@ func discoverDisks(root string) map[string]disk.DiskInfo {
continue
}
mountPath := filepath.Join(root, entry.Name())
if !disk.IsMountPoint(mountPath) {
continue
}
info, _ := disk.Probe(mountPath)
if info.State == disk.DiskAbsent {
continue
@@ -144,8 +147,10 @@ func discoverDisks(root string) map[string]disk.DiskInfo {
// If no child mountpoints were detected, the disk may be mounted directly at root.
if len(disks) == 0 {
if info, _ := disk.Probe(root); info.State != disk.DiskAbsent {
disks[root] = info
if disk.IsMountPoint(root) {
if info, _ := disk.Probe(root); info.State != disk.DiskAbsent {
disks[root] = info
}
}
}
return disks