First check your details
- Check free space of the all partition
df -h
- Check /var/vmail space usage
du -hs /var/vmail
Now we can start as follows
- Stop postfix and dovecot service
systemctl stop postfix dovecot
- 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.
- Keep a backup of /var/vmail directory
mv /var/vmail /var/vamil.orig
- Next, create a symlink to new location from old location
ln -s /home/vmail /var/vmail
Symlink creates a reference from new location to old location.
- Now, start postfix and dovecot
systemctl start postfix dovecot
That’s it.
You can then test send and receipt of emails. If all looks okey, then you can delete the /var/vmail.orig folder to make the space available.