Increase disk space on RHEL 5 (Linux)
Problem Description :
A need to increase available disk space on RedHat server
Resolution :
NOTE: USE BEST SOLUTION #373 - INCREASE DISK SPACE ON REDHAT SERVER. THIS SOLUTION WORKS BUT #373 IS THE RECOMMENDED METHOD FROM VMWARE.
1 - On a VM, first need to increase the allocated disk storage in vSphere client for the VM server. The VM might need to be shut down for this to work.
2 - Run series of commands below as ROOT on the VM. These steps were found at URL http://kb.hyve.com/wiki/Vmware%20Resize%20Linux%20Hard%20drive%20Increase%20Size%20Enlarge%20Disk
Resize partitian table#
fdisk -l
fdisk /dev/sda
p (to print)
d (to delete)
2 (choose second one)
n (to recreate)
p (choose primary)
2 (choose second one)
enter (to except new size)
enter (to accept last one)
p (show new size)
t (change type)
2 (choose second one)
8e (to change patitian type code)
p (to print shows 83 changed to 8e)
w (to commit changes)
Reboot VM
Resize physical volumne#
pvdisplay /dev/sda2 (show old size)
pvresize /dev/sda2
pvdisplay /dev/sda2 (to show new size)
Extend volume group#
vgdisplay (show free space available, use "Free PE / Size" in Blocks for $FreePESize parameter below)
Register Volumes#
vgscan
vgchange -ay (activate the lvm)
Extend Logical Volume#
Used/Tested option #1 below
lvextend -l +$FreePESize /dev/VolGroup00/LogVol00 (use the Free PE/Size in Blocks from above)
or
lvextend -l +$FreePESize /dev/VolGroup/lv_root (the 64 is the param above)
Resize File System#
Used/Tested option #1 below
resize2fs -f /dev/VolGroup00/LogVol00
or
resize2fs -f /dev/VolGroup/lv_root
Wait until this is finished.#
Sync buffer to disk#
sync
Now wait 2 minutes for a small increase, or 5 minutes for a large increase.
sync
Shutdown VM#
shutdown -h now
wait for machine to shutdown properly
start machine as normal
If it fails when booting up, then run the fsck and click Y, then run this when OS starts from command line: resize2fs /dev/VolGroup00/LogVol00
Revision Date : 6/20/2016