Added howto for extending a logical volume

This commit is contained in:
Michele Cereda
2023-02-02 22:43:44 +01:00
parent 026400a1da
commit 0bd9676a2e

View File

@@ -0,0 +1,34 @@
# Resize a Logical Volume
## TL;DR
```sh
# 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'
```
```yaml
#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'
```