How to extend or increase LVM in linux
How do I increase the capacity of my LVM partitions in linux if I add another disk or raid array
You need to add the new physical volume, extend the volume groups, increase the logical volume and resize the file system
Create the Partition with id LVM Linux
sd(x) where x is the new disk a,b,c,d for this example I will sdc as it is the third drive I have added to the system
# fdisk /dev/sd(x)
Command (m for help): n
Command (m for help): p
Command (m for help): 1
Command (m for help): t
Command (m for help): 8eCommand (m for help): w
Device Boot Start End Blocks Id System/dev/sdc1 1 243200 1953503968+ 8e Linux LVM
How to List Physical Volumes, Volume Groups, and Logical Volumes
Before we get started its a good idea to know how to list what we need to know.
# pvdisplay
# vgdisplay
# lvdisplay
Add the LVM Physical Volume
# pvcreate /dev/sdc1
Extend an Existing Volume Group
vg_1 is the volume I want to extend
# vgextend vg_1 /dev/sdc1
Extend an Existing Logical Volume
You have a lot of control on how much you want to add. For this example I want to add the entire amount available that I can grow this lvm lv by.
I am increasing the Logical Volume “lv_home”
# lvresize -l +100%FREE /dev/vg_1/lv_home
Extending logical volume lv_home to 5.40 TiB
Logical volume lv_home successfully resized
Resize the File System
Now lets resize our file system to include our newly added lvm space. We are doing this without umounting the partition.
resize2fs /dev/vg_1/lv_home
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_1/lv_home is mounted on /home; on-line resizing required
old desc_blocks = 230, new_desc_blocks = 346
Performing an on-line resize of /dev/vg_backup1/lv_home to 1450352640 (4k) blocks.
Go get a coffee cause this is going to take a while!


