Skip to content

Commit

Permalink
Merge pull request #1442 from stgraber/lvm
Browse files Browse the repository at this point in the history
incusd/storage/lvm: Handle newer LVM
  • Loading branch information
hallyn authored Nov 30, 2024
2 parents a3ddd7b + 39d6313 commit 7fb9c60
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/server/storage/drivers/driver_lvm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,17 @@ func (d *lvm) lvmDevPath(vgName string, volType VolumeType, contentType ContentT

// resizeLogicalVolume resizes an LVM logical volume. This function does not resize any filesystem inside the LV.
func (d *lvm) resizeLogicalVolume(lvPath string, sizeBytes int64) error {
_, err := subprocess.TryRunCommand("lvresize", "-L", fmt.Sprintf("%db", sizeBytes), "-f", lvPath)
isRecent, err := d.lvmVersionIsAtLeast(lvmVersion, "2.03.17")
if err != nil {
return fmt.Errorf("Error checking LVM version: %w", err)
}

args := []string{"-L", fmt.Sprintf("%db", sizeBytes), "-f", lvPath}
if isRecent {
args = append(args, "--fs=ignore")
}

_, err = subprocess.TryRunCommand("lvresize", args...)
if err != nil {
return err
}
Expand Down

0 comments on commit 7fb9c60

Please sign in to comment.