Shrink or resize logical volumes LVM on RHEL
Posted by Marius Voila on April 02, 2010 in London, U.K . — 0 comments This post contains 285 wordsBy default RHEL, CentOS, Fedora use all available space for the LV “LogVol00″, which means that to shrink the partition you must first boot from the CenOS CD enter rescue mode then check the file system, resize the file system and then finally resize the LV. Worth noting this guide should work for just about any distro using LVM2, however the LV name will most likely be different, this guide also assumes you want to resize you LV to 10G, if you don’t obviously change the size.
Before carrying out any of this guide DO A BACKUP, if you mess up the chances are your box will be hosed! Also follow this guide in order, if you resize the LV before you resize the file system, then your system is going to be fubar…
This is how we do that:
Boot the first CentOS 5 CD and Press F5 and the boot prompt, then type “linux rescue†at the prompt.
Select your language and other relevent settings as the setup asks you, it will then display a message about auto detecting your CentOS installation, select skip.
This should now drop you to a prompt, type the following commands:
lvm vgchange -a -y
Check the file system to make sure it’s clean before we resize any thing:
e2fsck -f /dev/VolGroup00/LogVol00
Resize the file system using:
resize2fs /dev/VolGroup00/LogVol00 10G
Finally it’s time to resize the LV:
lvm lvreduce -L10G /dev/VolGroup00/LogVol00
You will get a warning message when you run the above command, I accepted this.
Reboot and you should be done!
You can thank me by linking to my Blog :)