On this page

  1. Links

Use mount --bind To Move The Website And Email Directory Of a ISPConfig 3 Server To a New Directory

In the following guide, I will explain the procedure on how to move the email and website directory of a ISPConfig 3 installation to a new partition. This might become handy when your current partition runs out of space. I will use a bind mount for this, a symlink will not work here as ISPConfig checks path for symlink attacks, so if the website or email path contains a symlink, ISPConfig will reject to write to that directory. In this example, I will move the www and email directory to the /home partition. You dont have to move both partitions together, so moving just the email or web partition will work as well.

Stop the email and web server

service postfix stop
service dovecot stop

When you use apache, use:

service apache2 stop

For nginx server, use:

service nginx stop

Move the email directory to the /home partition

mv /var/vmail /home/

and create a new mount point with correct permissions

mkdir /var/vmail
chown vmail:vmail /var/vmail

Move the www directory to the /home partition

chattr -i /var/www/clients/client*/web*
umount /var/www/clients/client*/web*/log
mv /var/www /home/

and create a new mountpont

mkdir /var/www

Now edit the /etc/fstab file to add the 2 bind mounts

vi /etc/fstab

add the following 2 lines right after the lines for your harddisk partitions

/home/vmail /var/vmail none bind,nobootwait,_netdev 0 0
/home/www /var/www none bind,nobootwait,_netdev 0 0

apply the new mount configuration

mount -a

and start the services

service postfix start
service dovecot start

for apache servers:

service apache2 start

for nginx servers use:

service nginx start


Share this page:

Suggested articles

14 Comment(s)

Add comment


By: js

Where en how do I edit  /etc/fstab to make this ("remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0") back working?

# /etc/fstab: static file system information.

# Use 'blkid' to print the universally unique identifier for a

# device; this may be used with UUID= as a more robust way to name devices

# that works even if disks are added and removed. See fstab(5).

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    defaults        0       0

# / was on /dev/vda1 during installation

UUID=ce8a4f13-1cd5-4f40-95ad-19522d5a5d82 /               ext3    errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0       1

UUID=992212e3-4582-459c-944b-48f05476cae7 /data-disk ext4 errors=remount-ro 0 0

/data-disk/www /var/www none bind,nobootwait,_netdev 0 0

/data-disk/vmail /var/vmail none bind,nobootwait,_netdev 0 0



By: babydunk


i would like to move the /var/backup dir because my backups are taking up far to much space for the root partition


would this be the right way to do that

mv /var/backup /home

mkdir /var/backup

nano /etc/fstab


/home/backup /var/backup none bind,nobootwait,_netdev 0 0


mount -a


service nginx start


thanks for you help in advance 


By: Jesse Norell

Moving mysql databases entails:


service mysql stop

mkdir /var/lib/mysql

chown --reference /home/mysql/ /var/lib/mysql/

chmod --reference /home/mysql/ /var/lib/mysql/

echo '/home/mysql /var/lib/mysql none bind,nobootwait,_netdev 0 0' >> /etc/fstab

mount -a

service mysql start

By: Jesse Norell

Moving mysql databases entails:


service mysql stop

mv /var/lib/mysql /home/

mkdir /var/lib/mysql

chown --reference /home/mysql/ /var/lib/mysql/

chmod --reference /home/mysql/ /var/lib/mysql/

echo '/home/mysql /var/lib/mysql none bind,nobootwait,_netdev 0 0' >> /etc/fstab

mount -a

service mysql start

By: Michael

When I did this, I now have a COPY of the /var/www directory in the /home/directory?  Even new sites that I create (did not exist before I did this) are being duplicated in the /var/ directory.  I was expecting it to MOVE the data and any new site would be created in the /home/ directory instead of the /var/ ... what did I do wrong or am I not understanding what this does?

By: till

When you followed this guide, then you moved the data from /var to /home, then you created a BIND mount which ensures that the /home directory is used. Check usage with 'df -h' command, you will see that space in /var has been freed and space in /home is used now. Of course, the file still show up in /var, that's the purpose of a bind mount, but they don't use any space.

By: Walter

Hi, i move the directory /var/www to /mnt/sdb, ftp and sites www function ok, but ISPconfig error 500. My english is bad ja. Thanks.

By: Walter

Expading description the error

/dev/sdb /mnt/sdb                                              ext4    defaults,users,rw 0       1/mnt/sdb/vmail /var/vmail none bind,nobootwait,_netdev 0 0 (this OK)/mnt/sdb/www /var/www none bind,nobootwait,_netdev 0 0Error log in suexec[2019-06-20 00:46:47]: (13)Permission denied: exec failed (.php-fcgi-starter)[2019-06-20 00:46:53]: uid: (5031/web41) gid: (5030/client37) cmd: .php-fcgi-starterAll php not run, html sites no problem

By: till

Most likely the filesystem you mounted is either not writable or not capable for this purpose e.g. if its a network filesystem with limited functionality or you copied the files without keeping permissions instead of moving them incl. all permissions. The issue is not really related to the tutorial here as its a problem with your target filesystem and not with the procedure described in this tutorial.

By: Walter

 Hi Till, thanks for you reply, i can see the error now, i paste the fix, the problem are mounting my disk:

/dev/sdb /mnt/sdb2                                             ext4    defaults,users,rw,exec 0       1

I need to override noexec defeult parameter con exec.

All run ok now.

My english is bad.

By: Baldwin

thanks for all the turorials.These instructions don't seem to work on Debian Buster, is there a newer tutorial?

By: till

This article works on Debian Buster too, there is no new article needed, it works on all Debian, CentOS, and Ubuntu versions.

By: Matt_LMK

I'm using a fresh install of ISPConfic 3.2.2 on Ubuntu 20.05. I've mounted a network drive at /mnt/alpha

I get the following error when trying to move the www directory

#mv /var/www /mnt/alpha/mv: cannot remove '/var/www/php-fcgi-scripts/apps/.php-fcgi-starter': Operation not permitted mv: cannot remove '/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter': Operation not permitted#

What am I doing wrong?

By: Florian

Run this command to fix it:


chattr -i -a /var/www/php-fcgi-scripts/*/.php-fcgi-starter