Merge pull request #955 from fancybits/disk-bind-root

[disk][linux] flag bind mounts
This commit is contained in:
shirou 2020-10-11 21:19:38 +09:00 committed by GitHub
commit 7144fe3fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -283,6 +283,14 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
mountPoint := fields[4]
mountOpts := fields[5]
if rootDir := fields[3]; rootDir != "" && rootDir != "/" {
if len(mountOpts) == 0 {
mountOpts = "bind"
} else {
mountOpts = "bind," + mountOpts
}
}
fields = strings.Fields(parts[1])
fstype := fields[0]
device := fields[1]