Jephe Wu - http://linuxtechres.blogspot.com
Environment: Fedora 3 or RHEL servers with LVM partitions
Objective: online increase partitions size including /, /usr, /var partitions
Steps:
1. login as root, run 'vgdisplay' to find out the free PE extend and size
Total PE 2039
Alloc PE / Size 1745 / 54.53 GB
Free PE / Size 294 / 9.19 GB
2. run 'vgdisplay -v' to find out the logical volume LV name which you want to increase, let's say it's /dev/VolGroup00/LogVol06
3. increase the 5 Physical Extent(PE)
lvm lvresize -l +5 /dev/VolGroup00/LogVol06
4. use resize2fs(RHEL 4, 5) or ext2online(Fedora, starting from Fedora 6, this command is removed) to online increase partition file system size
ext2online /dev/VolGroup00/LogVol06 [newsize]
resize2fs /dev/VolGroup00/LogVol06
Environment: CentOS 5.4, reduce /data from 100g to 50g, and increase / from 15g to 30g, still left 35g free for future
Steps:
umount /data
e2fsck -f /dev/VolGroup01/LogVol02
resize2fs /dev/VolGroup01/LogVol02 50G
lvreduce -L 50G /dev/VolGroup01/LogVol02
e2fsck -f /dev/VolGroup01/LogVol02
# online increase / partition from 15G to 30G and increase file system to make use of the full 30G space
lvresize -L 30G /dev/VolGroup01/LogVol00
resize2fs /dev/VolGroup01/LogVol00
vgdisplay -v
Use RIP Linux to shrink LVM root partition for default CentOS 5.3
Environment: default installation of CentOS 5.3 with a very bit /root LVM partitionObjective: reduce the root LVM partition to 20G file system size
Steps:
1. boot up with a RIP Linux CD
2. run command 'lvm -a y VolGroup00' to activate the volume group and logical volumes
3. resize2fs /dev/VolGroup00/LogVol00 20G
4. lvm lvresize --size 20G /dev/VolGroup00/LogVol00
note: to be very safe, you might want to resize logical volume to 21G instead of 20G, but according to the article from redhat access below, it's not required.
5. reboot
How do I reduce the size of the root file system after installation Red Hat Enterprise Linux 5?
I have attached above article from redhat below:
# lvm.static vgscan
# lvm.static lvchange -ay /dev/VolGroup00/LogVol00
# e2fsck -f /dev/VolGroup00/LogVol00
# resize2fs /dev/VolGroup00/LogVol00 3000M
# lvm.static lvreduce -L 3000M /dev/VolGroup00/LogVol00
# lvm.static vgdisplay VolGroup00
# exit