(865) 584-3355

Apple Certified Macintosh Experts
Serving East Tennessee since 1994

Server Configuration

mailbfr is a handy commandline utility you can use on your OSX Server installation to repair a corrupt mailbox or backup your entire mail database. Even though it is a commandline tool, it was written specifically for OSX.

**UPDATE** as of 3/18/2010, mailbfr is still not compatible with OSX Server 10.6. DO NOT attempt to run mailbfr on your 10.6 server until it has been updated to be compatible with the new mail system. Check their site frequently and send them email letting them know you are interested in a 10.6 version.

The download is a zipped .pkg file that gets installed by the OSX installer app. It handles the placement of the program and its support files where they have to go. You don't have to try to figure out how to run hard to understand unix scripts! The program itself is also a departure from other unix commands in that the man file is actually written for human beings, not hardcore unix admins who speak their own language. It gives real world examples instead of weird placeholders that only confuse you more.

After you get mailbfr installed, launch Terminal and just type mailbfr and see what happens. It will give you a friendly notice that you have to run it as the root user. You can either login as root or just do sudo mailbfr to get the access rights you need for it to run.

If you type man mailbfr it will give you the syntax for using it and all the options it does. If you type just mailbfr (as root) without any options, it will also give you a brief rundown of the options.

If all you want to do is setup a daily backup of your mail db, here is the quickest way to do that:

mailbfr -i

mailbfr will then prompt you for further input to create a cron job so it will do what you need when you need it. You don't have to fuss with manually editing a cron job and worry if you got the syntax right. When it is finished asking you questions and you tell it to save, it will display something like this:

The following cron job for 'mailbfr' has been enabled'
0 20 * * * /usr/sbin/mailbfr -b /mailbk --mode incremental

In this example, I have it running at 8:00pm (20:00) every day, to do an incremental backup to the folder /mailbk (the folder name was of my choosing, you can name it whatever you want.)

The backup can take quite some time to complete. For a small company with mabe a dozen mailboxes, it can take 10 minutes or so. Larger installations with more users and more emails can take considerably longer. Plan your tasks accordingly.

There are three caveats to using mailbfr:

1) when running mailbfr with any of the options, your mail service will be stopped while mailbfr does whatever you told it to do. Depending on the task you're having it perform, this could take anywhere from a few minutes to hours. There is no progress bar and no time estimate. You just have to wait it out.  It will restart the service once it is done. If you start mailbfr and need to stop it for some reason, you can do Cmd-. in Terminal and it should stop what it's doing and then restart the mail service. If for whatever reason the mail service does not start up again, you can just go into Server Admin and start it up from there.

2)your target location cannot include any spaces in the path. In the above example, /mailbk is really a symbolic link that points to a folder on the backup hard drive - /Volumes/Backup HD/mail. "Escaping" the space ( /Volumes/Backup\ HD/mail) does not work despite the developer's suggestion to do that. I could have renamed the hard drive to eliminate the space but there were other processes involved that needed the drive to stay the same name. Making a symbolic link on a path that didn't have a space was easier to do safely. If, however your target backup folder is on your boot drive, you shouldn't have to worry about spaces if it is the root volume /

3) when you specify the path, do not include a trailing / ie. /mailbk NOT /mailbk/

In the event you need to restore your backup, it's just a matter of running mailbfr -r /path/to/the/backup --all



The repair functionality of mailbfr is very helpful if any of your users aren't getting mail or their webmail is acting weird. If only one user is experiencing mailbox problems just specify the username. example: mailbfr -m jsmith 
If more users are having problems or you think the overall database could be messed up, then mailbfr -f is all you need (and maybe a little luck and a good backup.)