Recovering shared folder contents from tar.gz backup?
Kővári János
bsh at freemail.hu
Mon Jan 25 04:41:20 EST 2010
Andrew Morgan írta:
> On Fri, 22 Jan 2010, Kővári János wrote:
>
>> Hello everyone!
>>
>> Something has happened with one of my cyrus servers, which was hosting
>> one shared folder (with multiple subfolders in it). I still don't know
>> what has happened - most likely a mailboxes.db corruption, no idea why.
>> Since this is automatically backed up every 4 hours or so, it's gone - I
>> only have backups of this in an already corrupt state (assuming the
>> problem was corruption of this db)
>> I tried fixing things with reconstruct, but it didn't help, the shared
>> folder disappeared permanently, even though all the files are still in
>> the storage partition.
>> I have regular backups of the mail storage (simple tar.gz of the whole
>> structure), so nothing is lost.
>> Since all my attempts to recover the shared folder were unsuccesful, I
>> decided to wipe this partition and recreate it, with the exact same
>> structure, then tried copying back the data from a backup and then
>> reconstruct, but this didn't help at all, the recreated shared folder
>> still shows up as empty, reconstruct doesn't find the subfolders etc.
>> Could someone please tell me how to get my mail back frum the backup?
>> Thanks in advance!
>
> These are the steps I follow to restore a user's deleted mail. I
> assume you could modify them slightly to work on shared folders.
>
> 1. Locate user's mail directory
> (/var/spool/cyrus/mail/prefix/user/username).
> 2. Change to that directory.
> 3. Make a RESTORE directory (mkdir RESTORE).
> 4. Fix ownership/perms (chown cyrus:mail RESTORE; chmod 700 RESTORE).
> 5. Change to the directory containing the mail folder the user wants
> restored.
> 6. Run 'recover', the Legato backup client.
> 7. 'changetime' to change the time to recover data from.
> 8. 'add filename' to add the files to restore. To restore all the
> messages in the folder, use 'add *.'.
> 9. 'relocate RESTORE' to recover files into the RESTORE directory
> instead of the current directory.
> 10. 'recover' to recover the files.
> 11. 'quit' to quit out of the recover program.
> 12. Create a dummy cyrus.header file "(touch RESTORE/cyrus.header;
> chown cyrus:mail RESTORE/cyrus.header; chmod 600 RESTORE/cyrus.header).
> 13. Run "su cyrus -c '/usr/local/cyrus/bin/reconstruct -x -f
> user.username'".
> 14. Run "su cyrus -c '/usr/local/cyrus/bin/quota -f user.username'".
>
>
> Andy
Andy, thank you very much for your help!
I don't have 'recover', the Legato backup client. I was googling for it
and found a couple similar (non-free?) stuff, and became confused which
one you mean. And I was too lazy to try and install any of these and
fiddle with them.
So I was looking for another solution. Luckily, I found a very simple
and convenient method, and I got all the lost mail back. I describe what
I did, maybe it will be helpful for someone else too.
So, first, I opened one of the message files (which are numbered from 1.
to n. in the mail folders), and it seemed to be a simple .eml format at
first. This gave me the idea, basically.
I renamed one such files to "1.eml" and tried to import it into
Thunderbird - it opened fine, and it had all the info: sender,
recipient, date, attachment, everything.
Then I extracted my tar.gz file (the last known good backup) into a
temporary working folder. Shut down cyrus and deleted everything from
the maildir (to wipe out the mess I made with my previous attempts, so I
got a clean empty partition again), then restarted cyrus.
In the working folder, I deleted all the cyrus header, index and cache
files. Also deleted empty folders. Then recreated the folder structure.
(Just moved the subfolders from the maildir structure into their "real"
location, as it was displayed originally in the clients.)
Then I just renamed the numbered mail files to "<number>.eml" (ie. added
the eml extension to every file)
In a thunderbird client, installed the "ImportExportTools (mboximport
enhanced) v2.3.1.1" extension. This one is able to import .eml files
from whole folders and subfolders, keeping the folder structure too.
Imported the top level directory I created in my working folder, with
all the .eml files and its subfolders with just one click. It imported
everything nicely, keeping the folder structure too.
After it finished, I just moved this imported stuff back to the imap
server's shared folder, and done!
Everything is working fine now, again.
Still no idea, what happened with the server and why the shared folder
disappeared all of a sudden...
Cheers,
Janos
More information about the Info-cyrus
mailing list