How to RESIZE / root partition in RHEL5 (VM)?

Hi Team,

Require your expertise on how to resize / partition.
This is VM.

Thank you.
Reggy

[root@pluton01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              15G   13G  556M  96% /
/dev/sda1             965M   43M  873M   5% /boot
tmpfs                 502M     0  502M   0% /dev/shm
/dev/mapper/rhelvm-home
                       30G  185M   28G   1% /vol/home
/dev/mapper/rhelvm-backup
                      9.4G  6.0G  3.0G  67% /vol/backup


[root@pluton01 ~]# fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         127     1020096   83  Linux
/dev/sda2             128        2039    15358140   83  Linux
/dev/sda3            2040        2676     5116702+  82  Linux swap / Solaris
/dev/sda4            2677        7832    41415570    5  Extended
/dev/sda5            2677        7832    41415538+  8e  Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2610    20964793+  8e  Linux LVM

You have some other options:

What is your file system layout like?

Is the VM mapped to a physical block device or a file acting as one?

One thing to consider is that you can boot a recovery disk or something like a rescue CD image after presenting another disk or disk image and move /var /usr and /tmp to there. Those file systems tend to do well on their own partitions.

The way to go about this would be to present additional disk devices and then, from the system, modify the /etc/fstab file to point to the new devices. But, before you allow them to be mounted, I would suggest you rsync each directory to its new location. Once you have mounted the new location over the directory, the contents of those original directories will be inaccessible.

Take a look at this guide:

CentOS 5 - Resizing a Partition

You may want to create an LVM though. That way you will be able to resize the partition/filesystem online next time you run out of space.

You might also find it useful to check out what's eating all your space.

The partition that is to be resized must be unmounted when we do the resizing; obviously this is not possible if this is the partition that holds all important system files . Therefore we download a Live Linux-CD such as Knoppix from which we boot later on (if you have physical access to the system). If it is a remote system that you don't have physical access to, you need a rescue system on that system (a lot of hosting companies offer dedicated servers with rescue systems nowadays) that you can boot into (instead of Knoppix), and this rescue system must have the following tools: fdisk, umount, fsck, tune2fs, e2fsck, resize2fs.

for more details visit : How To Resize ext3 Partitions Without Losing Data | HowtoForge - Linux Howtos and Tutorials

If you kernel is newer than 2.6.10 you can online resize ext3 fs. Check man page command resize2fs.