I want to move some Mailbox directories to a new disk while postfix and courier imap daemons are still running.

The question is ¿what happens if a new mail is recieved into the Mailbox while moving the files? ¿is it safe?



Don't do it if you're using Mailbox files. If you were using Maildir you could do at least some of the work without shutting the services down.

Every email that is delivered, and every IMAP access, will alter the Mailbox files. You may end up with corrupted files.

The best you can do is to shut off IMAP and local delivery, while still allowing postfix to queue incoming mails. Then, once the move is finished, turn local delivery back on and all the queued mails will be delivered.

  • Thanks! I will try to reduce downtime using rsync too as @HBruijn proposed. – siete Dec 4 '13 at 15:33
  • Yep, rsync is very useful in situations like these. – Jenny D says Reinstate Monica Dec 4 '13 at 15:41

No it's not safe.

Declare a service window and schedule downtime. Your secondary MX will cache incoming mail and your users can do without, for a couple of hours even, if you schedule your maintenance window well.

Use rsync to copy the existing mail spool to your new disk and time how long a second run takes to determine the needed downtime. If your incremental rsync run for instance takes 4 hours, you need 5 hours of scheduled downtime. Start an rsync again 5-6 hours before the start of your downtime. If it doesn't complete before the actual start of your maintenance window, that's a No Go and reschedule.

If it does, then start your scheduled maintenance

  • suspend and disable automatic restart of incoming mail & IMAP
  • possibly go to single user mode
  • run rsync again
  • change your mount points
  • reboot
  • check if the new disk mounts correctly
  • enable incoming e-mail an IMAP again
  • reboot
  • declare success, GoTO pub or home after calling your manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.