Add a new disk to volume group
Extensible is one advantage of LVM, we can extend the logical volumes easily and do not have to umount partitions and move existing data.
- Create one or more partitions for the new disk, e.g. /dev/sdb.
fdisk /dev/sdb
- Format the partitions, e.g. /dev/sdb1.
mkfs -t ext4 -c /dev/sdb1
- Change the system id for partitions, e.g. /dev/sdb1, to Linux LVM(8e)
- Initial partition for LVM
pvcreate /dev/sdb1
- Add partition to existing volume group, e.g. vg_01.
vgextend vg_01 /dev/sdb1
- Extend the size of the logical volume.
Extend the size of lv01 by the amount of free space on /dev/sdb1:
lvextend /dev/vg_01/lv01 /dev/sdb1
Or, extend specified size:
lvextend -L +50G /dev/vg_01/lv01
- Online resize the logical volume.
resize2fs /dev/vg_01/lv01
Done.