Store E-Mail data on a different partition


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Email

Store E-Mail data on a different partitionLast Modified: Apr 19, 2020, 8:45 pm
By default, the Maildir data for system and virtual accounts live here:
  • /home/fred/imap/domain.com/user/Maildir
  • /home/fred/Maildir
where fred is the system account name.

There can be advantages for storing email data on a different partition:
  • Can use a smaller/faster disk with better I/O performance, needed by E-Mail's higher iops
  • Frees up space on website disk, also increasing website read performance
  • Prevents Users from accidentally deleting their email data

  • For this, we can make use of DirectAdmin's Custom Mail Partition option, which lets you specify some other parition or path, like /email, where data will be stored (instead of /home, eg: /email/fred/Maildir).

    Sound good?
    Here's how:
    1. We'll assume you've already got your new E-Mail partition mounted with quotas in /etc/fstab, and ready to go.
      First, tell DirectAdmin about it:

      cd /usr/local/directadmin
      ./directadmin set mail_partition /email
      service directadmin restart

    2. (OPTIONAL): Next, run a conversion simulation to see what DA would be running, if you've got questions:

      cd /usr/local/directadmin
      echo 'action=convert&value=mail_partition&simulate=yes' > data/task.queue.cb; ./dataskq d200 --custombuild

      Like how it looks? go to the next step.
    3. Convert:

      cd /usr/local/directadmin
      echo 'action=convert&value=mail_partition' > data/task.queue.cb; ./dataskq d200 --custombuild

    4. If you had any issues and need to run it again, but only want to check and run it for things that have not already been copied (only a basic directory existence check), you can add the quick=yes option to the conversion:

      cd /usr/local/directadmin
      echo 'action=convert&value=mail_partition&quick=yes' > data/task.queue.cb; ./dataskq d200 --custombuild

      Note that the action=convert&value=mail_partition task.queue request also support the use of &user=fred, in case you're only looking to run it for one account.
    5. Now that the data is correctly set, you should be able to login with your email accounts, the same way you did before. Existing data still there (there is a race during the copy, where it's possible for new messages to not be copied over).
    6. QUOTAS: With the E-Mail data being on a completely separate disk, you'll want DA to include it in the User's usage. Inform DA of the new partition by adding it to the Extra Quota Partitions option:

      /usr/local/directadmin/directadmin set ext_quota_partitions /email
      service directadmin restart

      If you have multiple other paritions, say /home2, they'ld be command separated, eg: ./directadmin set ext_quota_partitions '/home2,/email'
      and then have DA set all quotas:

      cd /usr/local/directadmin
      echo 'action=rewrite&value=quota' > data/task.queue.cb; ./dataskq d2000 --custombuild

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST