disk: ability to grow existing partitions

Apply the minimum size specified in the file system customizations 
also to existing partitions. Specifically, this now allows to set
a minimum size also for the root partition.
This commit is contained in:
Christian Kellner 2022-02-18 19:09:39 +01:00 committed by Tom Gundersen
parent 97754a2c99
commit b6cece8b28

View file

@ -34,7 +34,14 @@ func CreatePartitionTable(
for _, m := range mountpoints {
sectors := table.BytesToSectors(m.MinSize)
if m.Mountpoint != "/" {
// if we already have a partition ensure that the
// size is at least the requested size, otherwise
// create a new filesystem with that size
part := table.FindPartitionForMountpoint(m.Mountpoint)
if part != nil {
part.EnsureSize(sectors)
} else {
table.CreateFilesystem(m.Mountpoint, sectors)
}
}