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

Want to support HowtoForge? Become a subscriber!
 
Submitted by till (Contact Author) (Forums) on Fri, 2014-02-28 14:20. :: CentOS | Debian | Fedora | ISPConfig | Linux | SuSE | Ubuntu | Web Server | Email

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

 

Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.