Expanding A Root-FS
Expanding A Root-FS
There might be the situation, that your root filesystem runs out of space, so it has to be expanded. With filesystems other than the root filesystem this could easily be done for instance with gparted. With the root filesystem this is not possible, as gparted could only expand filesystems that are not mounted, which is impossible with the root filesystem. The only way to enlarge the root filesystem is to boot from a kind of rescuesystem, Live-CD or the like, and then to expand the root filesystem.
The following tutorial describes, how this is achieved by using Systemrescue-CD. SysRescCD is (as the name says) a kind of minimal Rescue Linux, often used as bootable CD or bootable USB Stick, or also usable as a bootable ISO Image directly in VMware ESX/Server, Virtualbox or similar virtualizers. It has a lot of useful stuff which could be used for maintenance tasks (to be honest, it is NOT minimal as written above).
As installations may differ widely, this tutorial could only be a kind of cooking recipe, a rough guide, and has to be adapted to the concrete setup. This procedure has been developed for a system running as VM under VMware ESX, the root filesystem being LVM2 based ext3, inside a SAN. Operating System was CentOS 5.
Be careful with all you are doing, all actions are performed with root permission. So make a full backup before you do anything other. You should also be familiar working in a shell. Also do whenever possible "dry-runs" before you do real modifications, and carefully inspect all messages whether they correspond with your expectations.
For details regarding SysRescCD please have a look at it's documentation on http://www.sysresccd.org/Online-Manual-EN
For details regarding LVM2 please have a look at the manpages or on http://sources.redhat.com/lvm2/ or http://www.sysresccd.org/Sysresccd-LVM2-Documentation
There is one other Rescue-System I'm aware of, which may also be used, namely GRML: http://grml.org/
Another distro which is also often used as a Rescue-System is Knoppix: http://www.knoppix.net/
A very tiny distribution, which may also do the job outlined below is Damn Small Linux: http://www.damnsmalllinux.org/
Let's dive in
* Create a new disk/partition in the Admin console of ESX
* Attach an ISO-Image of SysRescCD to the CD/DVD drive of the VM, and boot it. You should see the messages of the booting SysRescCD, and after a while you should get a prompt. If you have problems booting SysRescCD, or if you want to see the possibilities booting SysRescCD you can press F1 .. F7, and/or have a look into the documentation of SysRescCD.
Now we are ready to start:
and hope that X11 comes up. Otherwise you have to do the whole following procedure in the shell. But don't forget that you have several consoles you can access with <ALT>-<F1-F6>
* When X11 does not start, another possibility might be to fire up networking by doing
and the SSH server by doing
and try to run gparted with the help of the X-forwarding feature of SSHD, or may be you have luck to access the Rescue System by connecting the VNC Server.