How to Restore emails

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Fri Nov 13 08:08:55 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 12 Nov 2015, Mark Foley wrote:

>> About the 'cur' I'd not be too sure.
>
> Well, I'm just restoring to .Deleted Items, so it shouldn't be a problem. The tar restore
> should preserve names, permission, etc. I'll backup the current Maildir, the try the restore
> and see what happens. I'll report back.

a problem will arise, if Dovecot indexes the directory when the file is 
not fully restorred, hence, changes later.

Therefore, either prevent any access in Dovecot (deliver and retrieval) or 
use Heiko's approach, because mv is atomic on the same filesystem (rename 
instead of copy).

The next problem comes with duplicates, because Maildir saves flags, 
keywords and status in the filename.

I, therefore, copy a backup to another subdir, say "tmp2", then run fdupes 
(or similiar program) over cur, new and tmp2 to find duplicates, delete 
them in tmp2, and finally "mv -i " (you never know ;-) ) the remaining 
files from tmp2 to cur or new.

> -----Original Message-----
>> Date: Thu, 12 Nov 2015 23:36:52 +0100
>> From: Heiko Schlittermann <hs at schlittermann.de>
>> To: dovecot at dovecot.org
>> Subject: Re: How to Restore emails
>>
>> Hi,
>>
>> Mark Foley <mfoley at ohprs.org> (Do 12 Nov 2015 23:31:39 CET):
>>> According to a message to this list from Oli Schacher,
>>> http://www.dovecot.org/list/dovecot/2011-June/059493.html, all I need to do is copy the deleted
>>> emails to their original folder and dovecot will take care of it:
>>>
>> ???
>>>> exactly, just copy the mail from your backup back into the users
>>>> maildir (usually into 'cur'). Make sure the permissions of the restored
>>>> file are correct. No need to synchronize anything, dovecot automatically
>>>> detects the added message.
>>
>> About the 'cur' I'd not be too sure. If you *mv* the files there from a
>> directory on the same filesystem, you should be fine, but if copy the
>> files, I'd be careful. Probably you want to mimic the maildir behaviour:
>>
>>     copy the files to tmp/
>>     mv the files to cur/     (not sure, if new/ would be fine to,
>>                               because new/ is the natural place after
>>                               tmp/. I'm not sure, what this does to the
>>                               message state the client sees.)
>>
>>     Best regards from Dresden/Germany
>>     Viele Grüße aus Dresden
>>     Heiko Schlittermann
>> --
>>  SCHLITTERMANN.de ---------------------------- internet & unix support -
>>  Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
>>  gnupg encrypted messages are welcome --------------- key ID: F69376CE -
>>  ! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -
>

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEVAwUBVkWal3z1H7kL/d9rAQLcOwgAkkQTsr3/G3Hx8ic7Dbt+rq6nMEqbtaLJ
xv0S3YstOn4cfnadSCb3uWoAa3CGtdpS99dgr7U09Xyx6Jbq2WNElHgumVZVoJUz
qffFhMHl//QVPDDEHvsHJTnjuQEpLo6QAnd/2Sq6pJ5zQ4hL6Nf6WSJkEZ15GB8V
Zl9s9lnMDR3zEnKUzpFSAE4QVaM8PwByU91h2tc61Y+kVGFLrSJYfgfsLsNT+T4C
dC4YhSa85Y8nHj9grpk/aY1f8QndThRpSxDixMuLeYphY/Nc8XljAn986+7wA72Z
TszSvNrzNVz0qKxy7q+raTJ66bpxrlEwNCH9Fb33rC5Zk7WDwtfHAw==
=cBzu
-----END PGP SIGNATURE-----


More information about the dovecot mailing list