sysadmin: LVM expand volume by adding disk

Problem: You have LVM logical volume configured to hold a lot of data but at some point you ran out of space – you want to expand the logical volume space by adding more disks to the system.

Prerequisites: It would be very wise to use XFS filesystem on the large logical volume from the very beginning – aside from performance improvement it has 2 very important advantages:

  • Scheduled or recovery disk check is very fast, regardless of disk size (on disks bigger then 1Tb disk scan on boot takes considerable time – EXT3 takes hours to check)
  • You can expand filesystem while it’s mounted and “live” (in fact you have to have it mounted to do so), and this operation is quick and does not put your existing data in the harm way (when you are extending 20Tb logical volume to 40Tb because it’s almost full loosing all this data is not an option).

Now, down to business. Assumed setup:

  • Existing logical volume home on volume group vg00 with physical volume /dev/sda2, mounted under /home and formatted with XFS filesystem
  • The new disk being added is /dev/sdb1
  1. Create new physical volume and verify
  2. Add new physical volume to the existing volume group and verify
  3. Expand logical volume and verify
  4. Increase the filesystem size to the full size of the logical volume

You are done – enjoy your bigger logical disk.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">