Search K
Appearance
Appearance
If lazy_expunge plugin is used, it's usually easy to undelete accidentally deleted mails because of it, even if entire folders are deleted using doveadm. However, this doesn't help if lazy_expunge
isn't used, or if an administrator accidentally deletes the wrong users using doveadm obox user delete
or in some other way directly from the object storage (e.g. with obox-fs(1)
).
There is no direct function to recover the deleted objects in Dovecot and there should not be a need for it. However, admins are humans and things can happen by accident. Here's a process overview of what can be done in that catastrophic event to recover some of the mail data.
If the objects were deleted only from the object storage (and not from Cassandra), trying to access the mails will cause Dovecot to log errors about unexpectedly lost mails/indexes. Dovecot won't automatically remove these from Cassandra, so undeleting the objects from the object storage will finish the recovery.
From Dovecot point of view there should be snapshot made of Cassandra which includes the deleted object references. This snapshot should be recovered so that it can be accessed again (an alternative might be to read the sstables
snapshots directly from disk). If this is not the case, there are two more possibilities for data recovery:
deliver_log_format
setting includes %{storage_id}
, that expands to the object IDs. If the logs are still available, the object IDs for LMTP deliveries can be found from them. This won't help with mails saved via IMAP though.doveadm metacache unpack
. The unpacked indexes can be doveadm dump
ed to find the list of email object IDs.In any of the above cases the indexes most likely don't have the latest emails listed, so some of the newest mails will be lost. The only way to find them would be to list all objects in the object storage and try to find any mails whose object IDs aren't listed in any of the indexes. Those could be then HEADed to find out whether they should be recovered.
doveadm backup -u user mdbox:/tmp/user/mdbox
- This might delete index bundles in production. Probably won't, at least commonly, but if it does happen, the production will start logging errors about unexpectedly missing objects. Those objects can then be again undeleted from the object storage if it happens.doveadm sync -u user mdbox:/tmp/user/mdbox
- This will re-upload all the missing mail objects.