From b6cece8b2861620c61d56fd8ced4098215dc19e0 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 18 Feb 2022 19:09:39 +0100 Subject: [PATCH] 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. --- internal/disk/customizations.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/disk/customizations.go b/internal/disk/customizations.go index b063f3804..f0339a559 100644 --- a/internal/disk/customizations.go +++ b/internal/disk/customizations.go @@ -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) } }