Files
oam/knowledge base/resize a logical volume.md
2023-02-02 22:43:44 +01:00

758 B

Resize a Logical Volume

TL;DR

# Disk partition: /dev/sda2
# Logical volume: rootvg-rootlv

# Extend the partition.
# Optional; required only when there isn't enough space left on the disk.
sudo growpart '/dev/sda' '2'

# Extend the physical volume.
# Optional; required only when there isn't enough space left in the volume.
sudo pvresize '/dev/sda2'

# Extend the file system to the desired size.
sudo lvextend -rL '48G' '/dev/mapper/rootvg-rootlv'
#cloud-config

# 'growpart' only extends partitions to fill the available free space.
# At the time of writing there is no way to limit the expansion.
growpart:
  mode: auto
  devices:
    - /

runcmd:
  - pvresize '/dev/sda2'
  - lvextend -rL '48G' '/dev/mapper/rootvg-rootlv'