In this article, we will see how to move vmail to another partition.
When the disk space of the partition / or /var/ gets full, it’s better to move /var/vmail to larger partition which has more free space. Most suitable director is /home.
So, let’s get started.
If you want to check free space of the all partition, you can use following command:
# df -h
First, check /var/vmail space using following command:
# du -hs /var/vmail
1. Stop postfix and dovecot service:
# systemctl stop postfix dovecot
2. Use rsync command to copy the vmail directory to new location
# rsync -av /var/vmail/ /home/vmail/
Note: above command will copy vmail to /home/vmail with all existing permissions.
3. Keep a backup of /var/vmail directory
# mv /var/vmail /var/vamil.orig.bak
4. Next, create a symlink to new location from old location
# ln -s /home/vmail /var/vmail
Symlink create a reference from new location to old location.
5. Now, start postfix and dovecot
# systemctl start postfix dovecot
That’s it. We have ran all necessary commands.
Send a test mail and if all works well, you can delete the /var/vmail.orig.bak directory to make the space available.
In this article, we have seen how to move vmail to another partition.
[Need assistance to fix this error or install tools? We’ll help you.]