How to backup messages in linux postfix mail server

Dear Sir/Madam:
I have an redhat enterprise linux working as a mail server with postfix and dovecot imap now i am planning to re configure the postfix by the mysql feature for the virtual user but the existing users messages should be taken a back up , please tell me how to take a backup of messages(inox and sent messages) and after the sucessful reconfiguration of postfix with mysql then copy the messages back to the users mail path then the users will not lose their messages, please help me on this, thanks in advance.

Who is Participating?
Daniel McAllisterConnect With a Mentor President, IT4SOHO, LLCCommented:
Good news... this will be easier than you think...

Assuming you've been using defaults, your user's messages (Inbox, Sent, Drafts, Trash, etc. etc.) are located in their home directories (typically, ~/Maildir). If you setup your postfix to use mbox instead of maildir for delivery, then you'll want to fix that while you're creating your virtual user environment, and you'll also have to "import" the Inbox messages from their current mbox location (usually /var/mail/username)

What will happen when you switch to a virtual user model is that, since there won't be any specific Linux username associated with each e-mail user anymore, the messages will have to be in some specific folder (e.g.: /home/vpopmail).

Reconfiguring PostFix shouldn't affect your old messages in any way -- but kudos to you for wanting to back them up! (Again, you should find them in the user's home directories -- typically, ~user/Maildir/ -- with the other folders as sub-directories of that location. Typically, organization is done by folder, messages are in the contents of the regular files in that heirarchy).

OK, so once you've backed up the data, you'll want to shut off your server & perform your reconfiguration to the virtual user space (assuming from your question that you're already aware of how to do this).

Next, add in the existing user accounts (previously system accounts), and then copy in the folders we backed up moments ago. HINT: there is no need to keep the old messages in the users home folders... MOVE them to the new directory heirarchy! The "trick" to it is that you'll have to change the permissions on the files and folders to match what's expected in the new virtual user environment -- in the old way, the folders were owned by the users themselves. In the new way, they'll all be owned by a single user -- the virtual user management program you choose to use, e.g. vpopmail).

The hardest part of this is probably going to be the passwords -- previously, you probably used the Linux user password for each user, and the new virtual user system won't be able to use those (you cannot usually just import them, and there is no way to "unencrypt" them), so you'll wind up giving your mail users new passwords. Not to worry, the first time they try to connect with the OLD password, they'll be prompted to enter the new one.

I've kept this pretty high-level... so I hope it at least begins to answer your questions!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.