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

OR

#resize2fs /dev/main/root
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

1 Comment so far

  1. pravink.22 on December 11th, 2010

    Thxs buddy.. !!!!
    Check below mentioned url, very easy to understand
    http://www.redhatlinux.info/2010/11/lvm-logical-volume-manager.html

Leave a reply