Skip to content

Commit

Permalink
consider partitionless disks to have one partition
Browse files Browse the repository at this point in the history
Signed-off-by: Tai Groot <[email protected]>
  • Loading branch information
taigrr committed May 27, 2022
1 parent dac2f19 commit 9e418ac
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/block/block_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,23 @@ func diskPartitions(ctx *context.Context, paths *linuxpath.Paths, disk string) [
}
out = append(out, p)
}
// this is a disk with no partitions on it.
// Consider the filesystem on the disk to be a partition.
if len(out) == 0 {
size := partitionSizeBytes(paths, disk, "")
mp, pt, ro := partitionInfo(paths, disk)
du := diskPartUUID(ctx, disk)
p := &Partition{
Name: disk,
SizeBytes: size,
MountPoint: mp,
Type: pt,
IsReadOnly: ro,
UUID: du,
}
out = append(out, p)

}
return out
}

Expand Down

0 comments on commit 9e418ac

Please sign in to comment.