Logical Volume Management
Logical Volume Management
pvcreate /dev/sdb
vgextend vg00 /dev/sdc
vgcreate vg01 /dev/mapper/mpathb
lvresize -r -L+2G /dev/mapper/vg00-blaataap
lvextend -l +100%FREE /dev/mapper/vg01-blaataap
resize2fs /dev/mapper/vg00-blaataap
xfs_growfs /dev/mapper/vg00-blaataap
lvcreate -l 100%FREE -n blaataap vg01
lvcreate -L4G -n blaataap vg00
mkfs.ext3 /dev/mapper/vg00-blaataap
If you made the mistake to extend the OS disk:
fdisk /dev/sda
remove partition 2 (/dev/sda2) add new partition (check start sector) change change a partition’s system id write
reboot
pvresize
xfs_grow
done!
Extend LVM partition and disk
Extend disk in vmware. Then:
# find disks
lsblk
fdisk -l
# install growpart
apt-cache search growpart
cloud-guest-utils - cloud guest utilities
# growpart
growpart /dev/sda 3
#check
lsblk
# resize
pvresize /dev/sda3
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
Mounting LVM Partitions
Manually
lvdisplay # To lookup partition name
mount /dev/vg0/vol1 /mnt
fstab
/dev/vg0/vol1 /mnt ext4 defaults 0 0
/dev/vg0/vol1 /mnt xfs defaults 0 0
Resizing Volumes
lvresize -L 50G /dev/volgrp/<name> # Resize volume to 50GB
resize2fs /dev/vda
xfs_growfs /dev/vda