Given a file-system backup of dovecot
mailboxes (all in mdbox format) with a structure that looks something like the following:
/path/to/backups/2023-03
/path/to/backups/2023-03/attachments
/path/to/backups/2023-03/mailboxes/example.org
/path/to/backups/2023-03/mailboxes/examble.org/user
What is the easiest way to import messages for a specific user from the backup to the current version of their account, into a specific folder?
For example, to import the contents of INBOX and Sent for [email protected] into the current version of that user's Archive folder?
Additional Details
To give a little background, the server is configured to move messages older than six months for each user into an Archive folder (excluding messages in Junk or Trash), but one particular user appears to have lost the contents of their Archive at some point (I suspect accidental deletion rather than data loss).
However I have regular backups created using rsync
(each a full copy of the attachments and mailboxes folders, with hard-links of unchanged files from previous backups).
I've already located the backup that has a full copy of the Archive folder before the loss of messages, and my hope is to copy all messages from that into the live version of the folder, then walk through the backups doing the same for some other folders to ensure nothing is lost.
I'm hoping dovecot already handles deduplication, but if duplicates do occur then it's no big deal. The key thing is to ensure I can get all messages from some (not all) folders of a backup mailbox, including any attachments in the separate attachments folder, and copy them into the user's current Archive folder.
Answers don't need to worry about the actual process of walking through the backups etc., I just need to know which doveadm
commands I should be using to copy messages, as I've been finding the documentation a bit confusing (no examples have seemed to be quite what I need).