• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Change the default location of mailboxes in Debian Stretch

9musashi

Basic Pleskian
Hello, I have a Debian 9 box with Plesk Onyx Version 17.8.11 Update #11

I follow the guide at How to change the default location of mailboxes in Plesk for Linux?

First, I migrate all my subscription via Plesk Migrator Tool before I move the default mail folder location from /var/qmail/mailnames/ to /mnt/MailStorage/mailnames/

But there are 2 problems I have:

1. At the step 9
Code:
# chcon -R -t mail_spool_t <new_mailnames_directory>
It throws a lot of errors
Code:
chcon: can't apply partial context to unlabeled file

2. And at the step 10 (/etc/passwd) there is no
Code:
popuser:x:30:31:POP3 service user:/var/qmail/popuser:/sbin/nologin
there is only a similar line
Code:
popuser:x:30:31:POP3 service user:/var/qmail/popuser:/bin/false
So what I did was just insert this line
Code:
popuser:x:30:31:POP3 service user:/mnt/MailStorage/mailnames/qmail/popuser:/sbin/nologin
after the above line.

So finally in my /etc/passwd I have these 2 lines
Code:
popuser:x:30:31:POP3 service user:/var/qmail/popuser:/bin/false
popuser:x:30:31:POP3 service user:/mnt/MailStorage/mailnames/qmail/popuser:/sbin/nologin

So far there is no problem, but I'm curious did I miss something because I dont want this mailserver has problem in the future because of misconfiguration. I also think the guide may need update for Debian 9.
 
Last edited:
Hey,

you should only have 1 line for each user in /etc/passwd. Delete the first line w/ old path (/var/qmail).

I don't know about chcon/seLinux, but I'm sure you'll find an explanation as to what the errors mean when you google them.
 
On second thought: Why change the default path anyway?
Assuming your goal is to use another partition for the mailbox storage,
you could just copy the content of /var/qmail to a new partition using rsync, then mount it at /var/qmail.

Code:
# rsync -av -A /var/qmail/ /mnt/MailStorage/
# mount | grep "on /mnt/MailStorage" | awk '{print $1;}' | xargs -I "%" sh -c "blkid | grep %"
The second command might fail on some systems, in that case just run blkid and look for the device name of your partition.
Copy the UUID and edit your /etc/fstab to permanently mount the partition at /var/qmail
Code:
UUID=<UUID-GOES-HERE>    /var/qmail     <FSTYPE>      <OPTIONS> 0 0

The " 0 0" at the end is used to specify backup behavior, adjust as needed.
Set "defaults" as options, add "discard" if it's the partition is on a SSD (comma-separated)
Also make sure to delete or comment (#) any lines already present for your partition (UUID or /mnt/MailStorage)
Re-Mount the partition without reboot:
Code:
# mount -a
 
Hey,

you should only have 1 line for each user in /etc/passwd. Delete the first line w/ old path (/var/qmail).

I don't know about chcon/seLinux, but I'm sure you'll find an explanation as to what the errors mean when you google them.

Thank you. I just delete the first line.

On second thought: Why change the default path anyway?
Assuming your goal is to use another partition for the mailbox storage,
you could just copy the content of /var/qmail to a new partition using rsync, then mount it at /var/qmail.
Very good idea. I ever thought to mount as /var/qmail before but worried about Plesk update will ruin it.

I follow the guide Plesk provided (not mount as /var/qmail) because I think it will be safer solution since Plesk itself recommend me to do that way.

Do you think the next Plesk update will overwrite my current config ?
 
Last edited:
Mounting a partition at /var/qmail won't affect plesk.
You should still stop the mail services before you copy the current content of that folder over to the new partition, so there won't be any inconsistencies during migration.

This usecase is basically what mountpoints in linux were designed to do.
Applications won't even notice they are accessing a new partition instead of a root filesystem subfolder.

The only component of Plesk that should care about mount points is the Hardware Diagnostics extension.
If you use it to show statistics about your disk space usage, you can just re-scan for new hardware so the partition shows up in the statistics.
 
Mounting a partition at /var/qmail won't affect plesk.
You should still stop the mail services before you copy the current content of that folder over to the new partition, so there won't be any inconsistencies during migration.

This usecase is basically what mountpoints in linux were designed to do.
Applications won't even notice they are accessing a new partition instead of a root filesystem subfolder.

The only component of Plesk that should care about mount points is the Hardware Diagnostics extension.
If you use it to show statistics about your disk space usage, you can just re-scan for new hardware so the partition shows up in the statistics.

Thank you for your help. I tried to move back to /var/qmail as Warden also has issue with this setup. Plesk should give more clearer information about move mail storage location - should mount it as the same /var/qmail/mailnames to avoid future problems.
 
Back
Top