New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

Move /var/vmail to /home/vmail

Started by Xtended2025, March 13, 2025, 08:08:19 AM

Previous topic - Next topic

Xtended2025

Due to lack of space in centos-root, I am trying to change the location of the mail folder from /var/vmail to /home/vmail.

I used this tutorial:
https://wiki.centos-webpanel.com/move-varvmail-to-another-partition

I also changed in /etc/postfix/main.cf
virtual_mailbox_base = /var/vmail
to
virtual_mailbox_base = /home/vmail

And in /etc/dovecot/dovecot.conf
mail_location = maildir:/var/vmail/%d/%n
to
mail_location = maildir:/home/vmail/%d/%n

I restarted postfix and dovecot but when I try to log in to Roundcube, I get the error:
Cannot connect to imap server

Where am I going wrong?
:(

cyberspace

1. Make sure dovecot is up and works.

2. Make sure access permissions and owner of the folder:
/home/vmail
are  correct.

3. Check mail logs to investigate the problem:

/var/log/maillog

4. If you decided to move some system folder to another location then I recommend to follow the steps like:

mv /var/vmail /home/
ln -s /home/vmail /var/vmail

Xtended2025


Instead of mv i've used rsync -av. After that i've double checked and all the files and folders are there and are correct (home/vmail). And have the right permissions  (i've used chmod 770 /home/vmail and chown vmail.mail /home/vmail
Maybe I should also restart cwpsrv, apache and nginx?

cyberspace

The access permissions 777 or 770 not always are correct. Some applications/system services check access permissions and if they aren't strict enough the service fails for security reasons.

Check the files/folders inside /home/vmail/DOMAIN.COM. The should belong to "USER:vmail".

No, you don't need to restart cwp,nginx,apache.

Check mail and roundube log files. The log files are the best friend for INVESTIGATION. Currently we are guessing where the problem is.

Xtended2025

Folders inside /home/vmail belongs to vmail:mail and have permission 700

Xtended2025

I did a test with one of the folders in /home/vmail
chown -R USER:mail /home/vmail/USER.ro

Then from cpanel I created an email address test@USER.ro

I sent an email that I received.
But the email address is still created in /var/vmail/USER.ro and not in /home/vmail/USER.ro  ???

cyberspace

remove /var/vmail and create a symlink from /var/vmail to /home/vmail:

rm -rf /var/vmail
ln -s /home/vmail /var/vmail

Xtended2025

The symbolic link is allready made.
ls -l /var/vmail

Output:
lrwxrwxrwx  1 root     root 11 Mar  9 22:32 vmail -> /home/vmail/

I allreay moved /var/vmail
The folder /var/vmail contains only 2 clients left, The rest of 10 mail clients are allready moved to /home/vmail
But when i accesed an account Roundcube directly from cPanel  (from that 10 account that are allready moved to /home/vmail), it connects to imap but none of the mails are loaded (Inbox empty, Sent, empty)...I should have a lot of e-mails in Inbox and Sent, and phisically exists on /home/vmail/USER

cyberspace

QuoteThe symbolic link is allready made.

The folder /var/vmail contains only 2 clients left, The rest of 10 mail clients are allready moved to /home/vmail

The link doesn't exist. There could be the symlink OR folder. Check it once again.