fix(initramfs): Allow data partition to grow

This fix ensures that we always grow the data partition during an installation.

Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This commit is contained in:
Brad Beam 2019-08-06 22:08:16 -05:00 committed by Brad Beam
parent ec3c77d863
commit 53b1330c44

View File

@ -18,10 +18,12 @@ import (
func MountPointsForDevice(devpath string) (mountpoints *mount.Points, err error) { func MountPointsForDevice(devpath string) (mountpoints *mount.Points, err error) {
mountpoints = mount.NewMountPoints() mountpoints = mount.NewMountPoints()
for _, name := range []string{constants.DataPartitionLabel, constants.BootPartitionLabel} { for _, name := range []string{constants.DataPartitionLabel, constants.BootPartitionLabel} {
opts := []mount.Option{}
var target string var target string
switch name { switch name {
case constants.DataPartitionLabel: case constants.DataPartitionLabel:
target = constants.DataMountPoint target = constants.DataMountPoint
opts = append(opts, mount.WithResize(true))
case constants.BootPartitionLabel: case constants.BootPartitionLabel:
target = constants.BootMountPoint target = constants.BootMountPoint
} }
@ -35,7 +37,7 @@ func MountPointsForDevice(devpath string) (mountpoints *mount.Points, err error)
} }
return nil, errors.Errorf("probe device for filesystem %s: %v", name, err) return nil, errors.Errorf("probe device for filesystem %s: %v", name, err)
} }
mountpoint := mount.NewMountPoint(dev.Path, target, dev.SuperBlock.Type(), unix.MS_NOATIME, "") mountpoint := mount.NewMountPoint(dev.Path, target, dev.SuperBlock.Type(), unix.MS_NOATIME, "", opts...)
mountpoints.Set(name, mountpoint) mountpoints.Set(name, mountpoint)
} }