Ok, so you have a system with multiple SAN LUN's attached to it, and one of the logical volumes on that system is full and you need to grow it. Well that would be easy if you still have free space in your volume group. What if you don't?
Do you just add another LUN and grow your volume group, then extend your logical volumes? Well you could do that, but what about next time, or the time after that, you don't really want a bunch of LUN's attached do you? I can tell you that your SAN admin doesn't want to manage a butt load of LUNS on one machine. So what do you do?
Well you expand an existing LUN! Thats what!
I know your thinking but how do I do that? Well as it turns out it is really easy and I will try and convey the steps below.
- Find the LUN number of one of the currently attached LUN's on your system, this will be the one we grow.
- Have your SAN admin grow that LUN by whatever amount you need (100GB for example).
- Reboot the server. (This is done because the system will still see the LUN as its original size even after the expansion until a reboot. There should be a way to rescan the scsi bus however everytime I try this it crashes my machines)
- Confirm that fdisk sees the new size with 'fdisk -l /dev/<SAN DEVICE>'.
- Run 'pvresize /dev/<SAN DEVICE Partition>', to change the physical volume metadata.
- Run 'vgdisplay <vgname>' for the volume group that LUN belongs to and voila you should see the volume group now has free space, or more free space depending on your situation.
- Simply run the normal "lvextend" commands to add space to your logical volumes.
- Run the normal 'ext2online' command to see the new space on your logical volume, and bob's your uncle, you've got new space.
Now go and check your mount points and see all of your data still intact. Fantastic isn't it?

Recent Comments