Restoring vPostMaster from Backup
Common tasks on all distributions
NOTE: The "vpostmaster-configfiles.tar.bz2" and
"vpostmaster-database.sql.bz2" files used in this recipe are only
updated automatically every hour. You can force an update by running, as
root, "/etc/cron.d/vpostmaster-backup". This should be done to ensure
you have the most up-to-date copy of the data.
If, during the database load step, you see the error
"invalid byte sequence for encoding", you will need to run the following
commands:
cd /location/of/db/dump/file
bunzip2 vpostmaster-database.sql.bz2
mv vpostmaster-database.sql.bz2 vpostmaster-database-old.sql.bz2
iconv -c -f UTF-8 -t UTF-8 -o new-db.sql vpostmaster-database.sql
mv new-db.sql vpostmaster-database.sql
bzip2 vpostmaster-database.sql
You can then re-run the database load.
Newer versions of Dovecot have changed the configuration file
format. If you are recovering on a system with a newer version of the
dovecot POP/IMAP library, you will probably want to keep the original
dovecot.conf, the "setup" script fix it during the restore.
If dovecot fails to start, check the mail log files. Newer
versions of dovecot require a line to be added to the
/etc/dovecot-pgsql.conf file which reads "driver = pgsql". Once you
have added this line, run "/etc/init.d/dovecot restart".
For All Platforms:
You will need to recover all the data from
"/var/spool/vpostmaster". This includes all of the mail data as well as
database dumps and config files.
Note: You can manually trigger the config files and
databases to be dumped by running "/usr/lib/vpostmaster/bin/vpm-backup".
This normally runs from cron periodically, but if you are not in a
disaster situation, in other words you are deliberately saving and
restoring (doing a server upgrade, migrating to new hardware).
For Fedora/CentOS/RedHat Enterprise:
Stop any processes that may be accessing the database:
service postfix stop
service dovecot stop
service httpd stop
service postgresql restart
Restore the database from the
/var/spool/vpostmaster/vpostmaster-database.sql.bz2 file with the
following multi-line command:
bunzip2 -c /var/spool/vpostmaster/vpostmaster-database.sql.bz2 \
| su postgres -c 'cd; dropdb vpostmaster; createdb vpostmaster; \
psql -d vpostmaster'
Restore config files. The "vpostmaster-configfiles.tar.bz2" file
contains all configuration files related to vPostMaster. This will need
to be restored on the new machine.
To see what is in the backup copy, you can run "tar tfj
vpostmaster-configfiles.tar.bz2".
To extract these files, usint he following commands (as root):
cd /
tar xfj /path/to/vpostmaster-configfiles.tar.bz2
Re-run the setup script, which will fix all permissions and
restart the services:
/usr/lib/vpostmaster/bin/setup-fc3
For Ubuntu/Debian:
Stop any processes that may be accessing the database (the
version numbers installed on your system may differ from below):
/etc/init.d/postfix stop
/etc/init.d/dovecot stop
/etc/init.d/apache2 stop
/etc/init.d/postgresql-8.1 restart
Restore the database from the
/var/spool/vpostmaster/vpostmaster-database.sql.bz2 file with the
following multi-line command:
bunzip2 -c /var/spool/vpostmaster/vpostmaster-database.sql.bz2 \
| su postgres -c 'cd; dropdb vpostmaster; createdb vpostmaster; \
psql -d vpostmaster'
Restore config files. The "vpostmaster-configfiles.tar.bz2" file
contains all configuration files related to vPostMaster. This will need
to be restored on the new machine.
To see what is in the backup copy, you can run "tar tfj
vpostmaster-configfiles.tar.bz2".
To extract these files, usint he following commands (as root):
cd /
tar xfj /path/to/vpostmaster-configfiles.tar.bz2
Re-run the setup script, which will fix all permissions and
restart the services:
/usr/lib/vpostmaster/bin/setup-debian
Mailman
vPostMaster does not save copies of the Mailman mailing list
information in it's backups. To preserve Mailman lists, you will need
to follow these directions to copy Mailman from an existing system to a
new system.
To copy over Mailman mailing list information, you need to copy over
the following directories from the old machine:
/var/lib/mailman/archives
/var/lib/mailman/lists
/var/lib/mailman/data/sitelist.cfg
So, if you are on the new machine and are using rsync to copy the files:
OLD_SYSTEM=XXX.YYY.ZZZ.AAA # Change this to the real IP or name
rsync -av root@$OLD_SYSTEM:/var/lib/mailman/archives/ \
/var/lib/mailman/archives/
rsync -av root@$OLD_SYSTEM:/var/lib/mailman/lists \
/var/lib/mailman/lists
rsync -av root@$OLD_SYSTEM:/var/lib/mailman/data/sitelist.cfg \
/var/lib/mailman/data/sitelist.cfg
Now, fix the permissions with the "check_perms" script:
/usr/lib/mailman/bin/check_perms
Create the "mailman" list. Newer versions of Mailman require this
list. If you already have created the mailman list, this command is
safe to re-run:
/usr/lib/mailman/bin/newlist mailman
And restart mailman with:
/etc/rc.d/init.d/mailman restart