Skip to content

Commit

Permalink
Merge pull request #1291 from arstercz/master
Browse files Browse the repository at this point in the history
[disk][linux] fix readlink error which system boot by nfs mount
  • Loading branch information
shirou committed May 5, 2022
2 parents 24a1ae5 + f6dc96c commit 009ec50
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions disk/disk_linux.go
Expand Up @@ -351,10 +351,9 @@ 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)
}
d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1)
}
}
ret = append(ret, d)
Expand Down

0 comments on commit 009ec50

Please sign in to comment.