Custom partition location for email

Version 1.57

Feature
Finished

BETA New directadmin.conf option, NULL/blank by default (disabled): mail_partition= Where, setting it to a specific path, say /mail, where you might want to use a mail-only SSD, or something specific, to manage email data. After restarting DA, be sure to sync any live data via task.queue commands below. ================ REQUIREMENTS MUST use dovecot with dovecot=1 in the directadmin.conf. This should be the default, and most people will already have this set. ================ TASK.QUEUE There will be a command to convert accounts from /home/user/imap/* over to $mail_partition/username/imap. By default, that User's default disk usage limit will be set for the quotas (possibly another setting to allow xfs/ext4, etc.. in case the quota format is different). ------------------------ Conversion Per-User cd /usr/local/directadmin echo 'action=convert&value=mail_partition&user=fred' > data/task.queue; ./dataskq d200 All Users cd /usr/local/directadmin echo 'action=convert&value=mail_partition' > data/task.queue; ./dataskq d200 The conversion is "smart" in that it will check the new location for any matching filename. If they are the same, and the sizes and timestamps are the same, they're assumed to be the same data, and will not be copied. This way you can, more easily run this a few times if you need to, while being quicker on subsequent runs. However, with imap, if you flag or set a file as read.. etc.. it changes the actual file name. So multiple runs can in theory cause duplicate data, with the "read" message and the "unread" message possibly both showing up (for example). Hence it's best to avoid multiple runs where possible. If you do a per-User conversion (at first to test), cleanup that User first, before doing the "all users" run, so the test User doesn't get any duplicates. However, another option can be added: &quick=yes which simply check for the new /partition/username/imap folder. If that imap folder exists, then it's skipped without any per-file checks..so even faster. ------------------------ Simulation You can also add: &simulate=yes if you want to see what it's going to do, before you do it, and it will be shown in the dataskq output. The above action=convert *does* do the passwd rewrite for you, but if you need to do it manually (Eg: to quickly go back to the original, assuming you've not deleted the data yet) echo "action=rewrite&value=email_passwd&user=fred" >> /usr/local/directadmin/data/task.queue echo "action=rewrite&value=email_passwd" >> /usr/local/directadmin/data/task.queue ------------------------ Cleanup Once things are running, and you're 100% sure the new mail path is working as expected, you'll want to eventually delete the ~/imap data. To do this, again it can be done per-User or for everyone: Per-User cd /usr/local/directadmin echo 'action=delete&value=old_mail_partition&user=fred' > data/task.queue; ./dataskq d200 All Users: cd /usr/local/directadmin echo 'action=delete&value=old_mail_partition' > data/task.queue; ./dataskq d200 and as before, there is the optiont of: &simulate=yes to show what it's up to, without it actually doing anything ================ CONTROL DirectAdmin will simply be altering the path inside the file: /etc/virtual/domain.com/passwd as well as any internal path access for /home/user/imap/* to be /mail_partition/user/imap/* as both exim's LMTP and imap/pop usage will use these settings already. Note: Exim must use LMTP for delivery for this to work (newer 4.x exim.conf files already do this) ================ QUOTA If you want DA to set/manage quotas for this new partition, and if it's not on the same partition as /home, then add the new partition path to: ext_quota_partitions=/mail NOTE: the mail_partition does not need to be a "partition", but just the new path that DirectAdmin will use, instead of /home. So you could say, have: mail_partition=/var/spool/mail and id /var is it's own partition, add: ext_quota_partitinos=/var and ensure that quotas are setup on this partition. https://www.directadmin.com/features.php?id=611 =============== T13940 T15005

Interested to try DirectAdmin? Get a 30-day Free Trial!