How to resize a disk with LVM in Linux
- Log in to the device console as root.
- Check the devices of the virtual machine.
lsblk
- Extend the partition
cfdisk
- Resize the Physical Volume
pvresize /dev/sda3
- Resize the Logical Volume
For Debian:
lvextend -l +100%FREE /dev/mapper/hostname--vg-root
For AlmaLinux:
lvextend -l +100%FREE /dev/mapper/almalinux-root
For Ubuntu:
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
- Verify the type of filesystem
df -T
- Resize the filesystem
For EXT4:
resize2fs /dev/ubuntu-vg/ubuntu-lv
For XFS:
xfs_growfs /dev/mapper/almalinux-root
Published