🌱 activate LVM volumes at the start (#113)

This commit is contained in:
Itxaka
2023-04-19 16:23:51 +02:00
committed by GitHub
parent 6bf656cd21
commit f1c3aad0ee
7 changed files with 46 additions and 4 deletions

View File

@@ -262,3 +262,18 @@ func GetOemLabel() string {
}
return runtime.OEM.FilesystemLabel
}
func ActivateLVM() error {
// Remove the /etc/lvm/lvm.conf file
// Otherwise, it has a default locking setting which activates the volumes on readonly
// This would be the same as passing rd.lvm.conf=0 in cmdline but rather do it here than add an extra option to cmdline
_, _ = CommandWithPath("rm /etc/lvm/lvm.conf")
out, err := CommandWithPath("lvm vgchange --refresh --sysinit")
Log.Debug().Str("out", out).Msg("vgchange")
if err != nil {
Log.Err(err).Msg("vgchange")
}
_, _ = CommandWithPath("udevadm --trigger")
return err
}