How to move /var/vmail to a different partition in CWP

CWP stores mails in a folder called /var/vmail . This folder is normally located inside the root partition of your server.

Most times, the root partition is normally allocated a smaller amount of disk space than, say, /home partition. Most setups use /home for data storage while root partition only handles system files.

Sometimes, your emails may exceed the amount of space allocated for root partition and this would mean, the emails need to be moved to a different partition that could accommodate their size.

The steps below show you how to do this in CWP

1. Login to the server via SSH with root account

2. Stop Postfix and Dovecot services

systemctl stop postfix dovecot

3. Copy the /var/vmail folder to a new location using rsync command so as to preserve ownership and permissions. In our case, we will move the mails to /home/mail/

rsync -av /var/vmail/ /home/mail/

4. Rename the original mail folder

mv /var/vmail /var/vmail.bk

5. Create a symlink from new location to old as follow

ln -s /home/vmail /var/vmail

6. Fix file and folder permissions

chmod 770 /var/vmail
chown vmail:mail /var/vmail

7. Restart Postfix and Dovecot

systemctl start postfix dovecot

8. Login to one of your mailboxes and test send receive to ensure all is working well.

Was this article helpful?

Related Articles

Leave A Comment?