Linux LVM Extend on Software RAID Partition

Scenario / Question:

How do I extend my LVM to include another RAID Array partition

Solution / Answer:

Create a new Physical Volume

Extend the Volume Group

Extend the Logical Volume

Resize the File System to the new size

Display the current Physical Volumes:

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               main
  PV Size               68.26 GB / not usable 11.94 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              2184
  Free PE               1
  Allocated PE          2183
  PV UUID               21xQFY-1Gff-D1px-YqrS-Abrj-fgvl-MNIA5t

Create the new Physical Volume:

# vgextend main /dev/md3
  Volume group "main" successfully extended

Extend the Logical Volume by resizing it and using 100% of the new space on /dev/md3:

# lvresize -l +100%FREE /dev/main/root
  Extending logical volume root to 134.66 GB
  Logical volume root successfully resized

Alternatively you could increase the Volume size by using lvextend:

# lvextend -l +100%FREE /dev/main/root

Resize the File System online without unmounting:

#ext2online -C0 /dev/main/root

No Comments

Leave a reply