Wednesday, 11 July 2012

Extend Logical Volume RHEL/CentOS 6.x

In a previous post, I discussed how to generally manipulate logical volumes, the one thing I forgot to do was to do a real life test. What do I mean by a real life test?

We had an old box with a single hard drive and RHEL 6 installed on it. Unfortunately, it was a very small hard drive and we wanted to dump a database on that server to do a few tests, so we added another hard drive then did the following, hopefully self-explanatory:
  1. pvcreate /dev/sdb1
  2. vgextend VolGroup /dev/sdb1
  3. lvextend -l +100%FREE /dev/mapper/VolGroup-lv_root
  4. resize2fs /dev/mapper/VolGroup-lv_root
Now the root filesystem is a ginormous 38 GB, which is big enough for our purposes.

It's crucial that step 4 is carried out, as otherwise the filesystem will not extend to the totality of the logical volume, which is what was missing from my previous post.

No comments:

Post a Comment