How to backup messages in linux postfix mail server

Posted on 2009-02-13
Last Modified: 2013-12-16
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.

Question by:D_wathi
    1 Comment
    LVL 20

    Accepted Solution

    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!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Want to promote your upcoming event?

    Attending an event? Speaking at a conference? Or exhibiting at a tradeshow? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

    The Microsoft Exchange server database may become damaged or corrupted due to many reasons, such as system failure. When this happens, it is usually urgent to restore the system to a stable and working state. There are different symptoms and causes …
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now