Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

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

For details regarding LVM2 please have a look at the manpages or on or

There is one other Rescue-System I’m aware of, which may also be used, namely GRML:

Another distro which is also often used as a Rescue-System is Knoppix:

A very tiny distribution, which may also do the job outlined below is Damn Small Linux:


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:


* Type


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

net-setup eth0

and the SSH server by doing

/etc/init.d/sshd start

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.

* Now you have to find the devices which represent the root filesystem and the new partion/disk. You can inspect the startup messages of SysRescCD and try to find out the right devices by doing a

dmesg | less

Look for devices with hd or sd in it’s name. You could also do a

fdisk -l /dev/device

to show the partition table of the device you have guessed. It’s also a good point in time to look for all other infos you need later, namely Volume Groups in /dev, Logical Volumes in /dev/VolGroup*, and perhaps make a drawing with all involved components. Next following a short look into /dev/mapper and /dev/VolGroup00:

[root@localhost dev]# ll mapper/
total 0
crw------- 1 root root  10, 63 Nov  4 20:04 control
brw-rw---- 1 root disk 253,  0 Nov  4 20:05 VolGroup00-LogVol00
brw-rw---- 1 root disk 253,  1 Nov  4 20:04 VolGroup00-LogVol01
[root@localhost dev]# ll VolGroup00/
total 0
lrwxrwxrwx 1 root root 31 Nov  4 20:04 LogVol00 -> /dev/mapper/VolGroup00-LogVol00
lrwxrwxrwx 1 root root 31 Nov  4 20:04 LogVol01 -> /dev/mapper/VolGroup00-LogVol01
[root@localhost dev]# 

* Now partition the new disk, and create a new logical drive (or primary partition, as you like) and make the ID of the partition 0x8e (as we already have LVM on the root filesystem). This could be done with “fdisk”, “cfdisk” or (when X11 is running) much more comfortable with “gparted”. Assume the new partition is /dev/sda3.

* Next create a new physical volume on the partition by doing a

pvcreate –test -v /dev/sda3

Leave away the –test, when everything looks good.

* Do a

ll /dev/VolGroup*

and look which is the Volume Group representing your root filesystem by doing a

vgdisplay -v VolGroup00 | less

* Extend this Volume Group by doing a

vgextend –test -v VolGroup00 /dev/sda3

and check whether this is ok by doing a

vgdisplay -v VolGroup00 | less

* If everything is ok there should be an amount of free PhysikalExtents, that could all (or partially) be added to the Logical Volume. Do this by performing

lvextend –test -v -l +PhysikalExtents /dev/VolGroup00/LogVol00

again do a check by

vgdisplay -v VolGroup00 | less

* Next you can do a

lvscan -v

to do a further check, and do a

mkdir /mnt/newvol && mount -o ro /dev/VolGroup/LogVol00

* If you can see the content of the root filesystem, all is ok so far, and you can expand the filesystem itself. This is done by performing an

e2fsck -f /dev/VolGroup/LogVol00 && resize2fs -p /dev/VolGroup/LogVol00

This may take some time, depending on the size of your filesystem.

* Now do another

mount -o ro /dev/VolGroup/LogVol00

and you should see your expanded root filesystem.

* Now you can do a


followed by a


on the SystemRescueCD boot prompt (if you forgot to change the boot order in the VMware BIOS). Pray to the lord that all works well. Otherwise chances are high, that you have to do a complete reinstall.