Merge pull request #1291 from arstercz/master

[disk][linux] fix readlink error which system boot by nfs mount
This commit is contained in:
shirou 2022-05-05 17:24:46 +09:00 committed by GitHub
commit 009ec50f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -351,12 +351,11 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
// so we get the real device name from its major/minor number
if d.Device == "/dev/root" {
devpath, err := os.Readlink(common.HostSys("/dev/block/" + blockDeviceID))
if err != nil {
return nil, err
}
if err == nil {
d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1)
}
}
}
ret = append(ret, d)
}