ISPConfig Resizing Partitions

One problem with ISPConfig is the plethora of soft links and bind mounts used throughout. Web sites are located under /var/www/clients, with soft links going from /var/www/clients/client_id/site_id to /var/www/site-name. This is only one example. Also, /var/log/ispconfig/httpd/site-name is bind mounted to /var/www/clients/client_id/site_id/log.

This makes it difficult to get a clean umount of the /var/www partition. If /var/www is an LVM2 Logical Volume and you need to grow the volume (because you're running out of disk space), the best option is to reboot the machine and go into single user mode (aka emergency mode).

Following code does this for you. NOTE: we actually use ISPConfig on a Xen virtual, so there is no “console” we can log into in emergency mode except the built in VNC terminal. xl console will not work since that relies on the serial terminal, which appears to be off in emergency mode. So, be sure to get some kind of good terminal before doing any of this; something that will work no matter how you mess up the machine.

# Boot up (using vnc) and go into rescue mode
# or boot, then do an init 1
# either way, you MUST use VNC to do this as init 1
# does not have ssh or serial console
#
# Locate all log remounts and umount them.
# NOTE: this will find anything named 'log' so, for example
# it will try to umount wordpress log directories. However
# it will only throw a warning which can be ignored.
find /var/www -type d -name log -exec umount \{\} \;
# verify nothing is using /var/www
lsof /var/www # should return nothing
mount | grep '/var/www' # should return only /var/www
# This is the important part. If you can not umount /var/www
# you need to figure out what is locking the mount point, but
# you can not continue
umount /var/www
# YEA! we made it. We're assuming /var/vg0/varwww is the name
# of the LVM volume be increased
e2fsck -f /var/vg0/varwww
# set "number" below to the new size you want
lvextend -L number /var/vg0/varwww
resize2fs /var/vg0/varwww
e2fsck -f /var/vg0/varwww
# we're done, so reboot the machine and watch
# the boot process, then verify correct functionality
reboot