Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Installation

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment in the forums, please register and review our posting policy & tips. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-03-2007, 03:26 PM
Junior Member
 
Posts: 9
Exclamation Recover data from store folders

This is a desparate cry for help...please chime in if you can!

I have had MAJOR problems with my Zimbra intalation which was working fine for the past week and then completely stopped. I traced through one error after another, and was less than successful in getting it back up.

I have rebuilt my box, and recreated the users, so it is working again, but I NEED to recover the data from some of the users' folders (there's not that many). Is it possible to restore from the data in the /opt/zimbra/db/data/mbox... directories?? I tried copying them in, and then everything starts to go to h*** again.

Does anyone have any suggestions?
Reply With Quote
  #2 (permalink)  
Old 11-03-2007, 03:29 PM
Zimbra Employee
 
Posts: 5,606
Default

It would be very difficult to recover directly from the DB metadata. As a matter of fact, I've never actually done it.

Do you have a copy of your bad instance? It might be better to get that working, then either use that instance, or get it working enough to where you can export the data.
Reply With Quote
  #3 (permalink)  
Old 11-03-2007, 09:01 PM
Junior Member
 
Posts: 9
Default

I have bits and pieces of it. It won't start up, and I have honestly made so many changes and ran so many fixes and reinstalled the application (the list goes on...) that I don't really have the slightest idea where to begin to try to recover it, or if it is even possible. I was scrambling to try to get email access restored and was trying everything I could think of/find.

Any suggestion you have would be greatly appreciated.
Reply With Quote
  #4 (permalink)  
Old 11-03-2007, 09:16 PM
Zimbra Contractor
 
Posts: 5,651
Default

How 'few users'?
In the mean time while you're trying to get the box working - as I dont' know what your time frame/criticalness of getting certain messages is yet.

Now this will loose all folder structure, tags, read status - but you will at least get the messages.

Move the failedbox:/opt/zimbra/store to your livebox:/workspace/oldstore
(grab from the backups whatever just don't overwrite the live store!)

Steps:

Browse to the oldstore folder
make sure everything's owned by zimbra:zimbra

It has a subfolder called incoming that you can ignore
And at least one numbered folder starting with 0.
Look at the subfolders of these numbered folders, which are also numbered
In other words, oldstore/0/1, oldstore/0/2, etc.
Each of these sub-subfolders contains all the mail for a single user.
These leaf directories will be named something like store/0/1/msg/0
You'll have to figure out whose folder is whose by 'brainpower and observation' (more #-#.msg)
(oh you're gonna have some fun with remembering numbers & where your at!)

& you can add the messages in the leaf folders in that directory to the appropriate account on your live mailbox server as you wish or choose to leave the whole thing at /oldstore for a while

So, when you've figured out who a given folder belongs to:

Method 1:
attach to the new server via
zmmailbox -zadmin
or
zmmailbox adminAuthenticate -u https://server.domain.com:7071 admin@domain.com password
mbox> selectMailbox user@domain.com
mbox> createfolder /Recovery
mbox> zmmailbox addMessage /Recovery store/0/1/msg/1 (or whatever the path to the leaf folder is) -- all the mail in the subfolder will be added. Repeat for the remainder of the leaf folders in that mailbox's folder.
think it's -d if your having date trouble with the dates and the header
you can go zmmailbox help commands

Repeat for next user etc etc

Note: To get the dates correct you need to rewrite X-Zimbra-Received header see: http://www.zimbra.com/forums/adminis....html#post4017

Method 2:
zmlmtpinject -r user@domain.com -s sender@domain.com /opt/zimbra/location/#/#/msg/123-4.msg

Injecting a whole folder of files would be:
zmlmtpinject -r user@example.com -s sender@domain.com -d /opt/zimbra/location/#/#/

Rinse and repeat

If you do this a bunch over and over in a short time you might have you'll run into the single instance storage/drop duplicate fun. Though you can turn that off across the entire board by globally setting zimbraMessageIdDedupeCacheSize to 0 for a bit.

zmlmtpinject [options] [files]
[options]:
-a,--address lmtp server (default localhost)
-d,--directory message file directory
-D,--domain default per-connection recipient domain (default example.zimbra.com)
-N,--every report progress after every N messages (default 100)
-p,--port lmtp server port (default 7025)
-q,--quiet don't print per-message status
-r,--recipient envelope recipients (rcpt to). This option accepts multiple arguments, so it can't be last if a list of input files is used.
-S,--stopAfter stop after sending this many messages after warm-up
-s,--sender envelope sender (mail from)
-t,--threads number of worker threads (default 1)
-T,--trace trace server/client traffic
-u,--username username prefix (default "user")
-w,--warmUpThreshold warm-up server with first N messages, then start measuring (default no warm-up)
-z,--repeat repeatedly inject these messages NUM times
(won't actually make additional physical copies unless you turn off the zimbraMessageIdDedupeCacheSize)
[files]:
Direct link to file in rfc822 format, or specify a directory.

Note: To get the dates correct you need to rewrite X-Zimbra-Received header see: http://www.zimbra.com/forums/adminis....html#post4017

Method 3:

You can POST an RFC822 formatted message to your inbox REST url to append messages to the inbox folder. Using the popular curl program, this would look like the following:

curl -u username:yourpassword --data-binary @/tmp/rfc822.txt https://server/service/home/username/inbox

Method 4:

Thick clients that can take .msg
Import EML and MSG email message files into Outlook

--

Remember there's no metadata (like tags/flags/read status) attached to these methods.
Wherever possible I would provide a 'recovered' directory in the user's accounts.
The folder structure can get confusing fast, and you'll hate yourself if you end up putting stuff in the wrong folders...
One alternative is instead of working in the live you could setup an isolated temp box, import everything make it look 'pretty' then imapsync the temp box user's recoveryfolder > live.

Best of luck, and I hope you don't have to go those tedious routes.

Last edited by mmorse : 07-06-2008 at 11:20 AM.
Reply With Quote
  #5 (permalink)  
Old 11-03-2007, 09:18 PM
Zimbra Employee
 
Posts: 5,606
Default

What bits and peices?

The ones that you need to care about are:
/opt/zimbra/db
/opt/zimbra/store
/opt/zimbra/openldap-data OR /opt/zimbra/openldap.bak

With those, we can rebuild.
Reply With Quote
  #6 (permalink)  
Old 11-03-2007, 09:22 PM
Zimbra Employee
 
Posts: 5,606
Default

With regard to mike's post, that'll work too. Keep in mind that you'll loose all metadata.

I would only use that if you've lost the mysqldb. It's defenetly an option for disaster recovery.
Reply With Quote
  #7 (permalink)  
Old 11-03-2007, 10:00 PM
Zimbra Contractor
 
Posts: 5,651
Default

Quote:
Originally Posted by mmorse View Post
How 'few users'?
In the mean time while you're trying to get the box working - as I dont' know what your time frame/criticalness of getting certain messages is yet.

Now this will loose all folder structure, tags, read status - but you will at least get the messages.
yup, my methods will be a very tedious process & only help you with your messages

I had another thought if you do choose to do those:
The folder structure can get confusing fast, and you'll hate yourself if you end up putting stuff in the wrong folders...
So instead of working in the live you could setup a test box, import everything make it look 'pretty' then imapsync test > live.
Reply With Quote
  #8 (permalink)  
Old 11-04-2007, 08:59 AM
Junior Member
 
Posts: 9
Default

I think I have those files, but I ran an install.sh -u, so I am not sure if the files (other than the /opt/zimbra/db/data directory, which I took a manual backup of) are the originals.

The data I am extremely concerned about is the calendars and contacts. If I have to deal without the mesages, it won't be the end of the world, although it is not the preferred method.

When I looked in the store directory, one copy listed total 0, and the other listed incoming 0.

Thanks again for the help!
Reply With Quote
  #9 (permalink)  
Old 11-04-2007, 10:49 AM
Zimbra Employee
 
Posts: 5,606
Default

Dude-
I'm sorry to tell you this, but you're pretty much toast. install.sh -u does in fact remove everything. Even Mike's method won't work, as you don't have the message store.

The best hope you have is to take a look at the account db structure and try to export it, then import it. You'll need to try and dump the dbs to sql files, then reinject them. . .but that is further than a long shot.

I've never done it so I don't have any advice for ya. This wiki article might be able to provide more information:
Account mailbox database structure - Zimbra :: Wiki
the zmprov commands won't work, but it gives you an idea with how we store the data.

That's about the best I can do.

Good luck,
jh
Reply With Quote
  #10 (permalink)  
Old 11-04-2007, 11:37 AM
Junior Member
 
Posts: 9
Default

Thanks.

When I try to startup the services on the old box, it doesn't startup mysql.server.

When I run mysql start, I get error 1045 (2000): Access denied for user 'zimbra'@'localhost' (using password: YES). Any thoughts on how to get this resolved?
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
.pst migration issues jimklein Migration 13 02-16-2009 12:55 AM
Error when Using Outlook PST Importer chh Zimbra Connector for Outlook 1 01-19-2009 04:20 AM
IMAP error: unable to store IMAP message data ebatte Administrators 8 04-27-2008 09:50 PM
Postfix - fatal: Queue report unavailable - mail system is down? Chadsel Chen Administrators 2 02-12-2008 10:55 AM
mysql data store rebuild ashelley Administrators 2 05-31-2006 07:11 PM

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com

sourceforge.net



 

Search Engine Optimization by vBSEO 3.1.0