On 09/04/17 20:52, Dominic Raferd wrote: > Is there a best/recommended way to pause postfix local deliveries so > that I can take an LVM snapshot of the local mails for backup purposes? > The pause only has to be momentary, while the snapshot is taken, but the > files need to be in a consistent state. If anyone also knows the way to > pause Dovecot imap/pop3 similarly (as this could also be accessing the > same files), that would be helpful too.
I'm fairly sure you can just snapshot and any mail that has at least been queued will be safe, either in the queue or delivered. There is a small chance that the snapshot will be taken in between the point where the message is delivered and when it is removed from the queue in which case you can end up with a duplicate of that message when you restore as postfix will see the message in the queue and deliver it again. This is all minor in comparison to the mail that would be lost after the snapshot is taken and when the system dies before you restore (after the system dies you're actually safe because sending MXes will defer their mail to you). No amount of pausing during the snapshot will recover mail that you accepted after the snapshot. Even if you were to loose any mail that was in postfix during the snapshot (which won't happen) it's still negligible compared to what you'll loose after the snapshot. So at the end of the day I really wouldn't worry so much about this. Take your snapshot, and take your backup and understand that if you ever get to the point where everything blows up you *will* loose some mail, there is no real way around that. Peter