TIL: How to Extend a Logical Volume on Ubuntu
- Identify the LVM setup
lsblk
shows logical volumes (e.g.,lv_var
mapped to/var
).lvdisplay
verifies details, like LV Path/dev/VolGroup00/lv_var
.
- Resize the Physical Volume
- Use
sudo pvresize /dev/xvdf
(or the relevant device name) to claim the extra disk space.
- Use
- Extend and Grow in One Step
- For XFS (and many other filesystems),
lvextend -r -L +100G /dev/VolGroup00/lv_var
automatically resizes both the LV and the filesystem.
- For XFS (and many other filesystems),
- Finding the Device Name
cat /proc/partitions
lists partitions and sizes (e.g.,/dev/nvme1n1
might be your new disk topvresize
).
Also available at the Wordpress link
Thanks Nagendra Sahni for teaching me this technique on a deadline and reviewing the draft.