Backup and Restore
From Qmailtoaster
Back up and Restore
This script was originally written by Nate Davis (Website here[no longer online). He wrote a backup script, but had not gotten around to writing a restore script during the time I was switching from my QMail-Rocks install to QMail-Toaster. I work in an office for a bunch of lawyers and accountants, so keeping all of their archived email (on the server) was a VERY high priority. We (Jeremy Gall and myself) set out to finish the process, and came up with the restore portion of the process. I have modified Nate's original backup script a little to suit my needs, namely putting all the backed-up files into one archive that was easy to move to the new server. I also make use of a python script, queue-repair which was written by Charles Cazabon as a safety measure to make sure all of the messages get new inode numbers on the new mail server. Download the file, and uncompress it. Edit the backup-2.3.sh file and enter your own MySQL password. There are some other options in there that Nate wrote, such as curl'ing the files to another server, and sending an email notification letting you know the backup completed successfully. There are a couple of other options you can set if you need to - it should be commented sufficiently for you to understand what is going on.
Once you get another QMail server up and running, you can move the backup file to it (the script looks in the /root dir for the backup file). The script also expects to find the queue-repair tool in /root/queue-repair-0.9.0/ so you'll want to uncompress the archive for it in your /root directory also. Edit the script, entering your MySQL root password and any other variables you see fit. Read the script for more notes and documentation. Please note: THIS SCRIPT WILL REMOVE ANY DOMAINS AND/OR MAIL ACCOUNTS CURRENTLY ON THIS SERVER! You have been warned! Once you run the script you should be back up and running as if nothing ever happened. Don't forget to change it's IP address if you are not updating your DNS records! You may see some errors if you're moving from a new version to a new version - I run the dotqmail2valias script to convert the old style .qmail aliases to the new MySQL table version. Comment this line out if you don't want to see the errors.
The scripts are available here.[1]
The restore script is available as TEXT here. (This may be an older version, please see website for the current) [http://v2gnu.com/qmail/restore-1.2.sh.txt ]
Please add your requests for the next version here!
1. Backup and restore Squirrelmail address books (/var/lib/squirrelmail/prefs) - Done. JV
2. Backup and restore tcp.smtp and SpamAssassin prefs (local.cf and rules) - Now backs up tcp.smtp and the Bayes DB. local.cf will be added in next version. Rules will be omitted (this isn't a full-system backup, just the mail portion) JV
3. Enter text here