Back up and restore your mail server
WisMail can back up the message store and the server settings on a schedule, as ordinary zip files in a folder you choose. This guide shows how to set it up, what the backup contains and how to restore it. Please read the honest part first: there is no one-click restore and no restore button in web administration. A restore is a manual procedure that you should rehearse on a test server before you need it. Overview: Archiving and backup.
Backup types
| Type | What it contains | Typical use |
|---|---|---|
| Full | Everything: settings, license, certificates, spam data, mailing lists and all messages. | Weekly. |
| Differential | Settings and only the messages that are new or changed since the last Full. Smaller and faster. | Daily. |
| Copy (mirror) | A complete set like a Full, but it does not change what the next Differential includes. Started by hand. | Before an upgrade or a risky change. |
The schedule can run Full and Differential backups; a Copy is started with the Start now button.
Step 1. Open the backup settings
Log in to web administration and open Configuration, Archiving and Backup, tab Backup.
Step 2. Choose where the zip files go
- Tick Enable scheduled backup.
- Enter the Backup directory, for example
/var/backups/mail. If the folder does not exist the page offers to create it. - The backup directory must be different from the message store and from the archive directory, and it should not be the root of a disk (that content is removed with the program on uninstall). Put it on a different disk or a network share than the message store; a backup on the same disk does not protect against disk failure. For a network share enter the network disk user name and password.
Step 3. Choose how many to keep and the file size
Open the advanced settings: Split files at (GB) limits each zip volume (0.1 to 2 GB), and Complete backups to keep sets how many complete backups are kept (1 to 99); older ones are deleted automatically. Make sure the disk can hold that many copies of your store.
Step 4. Schedule the backups
Under Backup schedule choose Add backup schedule and set the day of week, the time and the backup type. A common pattern: a Full on Sunday at 02:00 and a Differential on the other days at 02:00. Two schedules cannot share the same day and time.
Step 5. Get notified
Enter a Notification email: the server sends a report when a backup completes, and an error report when the backup destination cannot be written (for example the disk is full or the share is not available). Then click Apply.
Step 6. Run the first backup and check it
Click Start now. The status area shows the progress and then Last backup succeeded with the date and size of the last Full, Differential and Copy. Check on the server:
ls -lh /var/backups/mail
Files are named with the type letter and the UTC start time: F20261121T020000Z.zip is a Full, D... a Differential, C... a Copy. A large set is split into volumes F...Z.zip, F...Z.1.zip, F...Z.2.zip, and each volume is a complete zip file on its own. Files being written end in .part and are renamed when the backup is finished: never copy a .part file.
Copy the backups off the server
A backup on the same machine is lost with the machine. Copy the zip files to another server or storage at least daily, for example with rsync or rclone from a scheduled job. Only copy files whose names end in .zip.
Restore by hand
There is no restore command-line tool and no restore page. The zip files are standard, so you restore by unpacking them and copying the folders back. Rehearse these steps on a spare server first.
- Prepare a server with the same WisMail version installed (see the install guide). If you are restoring on the same server, continue with step 2.
- Stop the service:
sudo systemctl stop wismail. - Copy the newest Full set (all its volumes) and, if you use them, the newest Differential set made after that Full to the server.
- Unpack each file into an empty working folder. The Full goes first, then the Differential on top so that its newer messages overwrite:
mkdir -p /root/restore && cd /root/restore
for f in /var/backups/mail/F20261121T020000Z*.zip; do unzip -o "$f"; done
for f in /var/backups/mail/D20261122T020000Z*.zip; do unzip -o "$f"; done
- Look at the unpacked tree with
find /root/restore -maxdepth 4 -type d. The filesmailserver.cfgandusers.cfgare the server settings. The other content sits under a folder named@backupwhose sub-folders mirror the ones under/opt/wismail:
| In the unpacked backup | Copy to |
|---|---|
mailserver.cfg, users.cfg |
/opt/wismail/ |
@backup/store/mail/ (messages) |
/opt/wismail/store/mail/ |
@backup/store/lists/ (mailing lists) |
/opt/wismail/store/lists/ |
@backup/license/, @backup/sslcert/ |
/opt/wismail/license/, /opt/wismail/sslcert/ |
- Keep a copy of the current files first, then copy the folders you need into place, keeping the same relative paths. Restoring only mail? Copy just
store/mail. - Start the service:
sudo systemctl start wismail, then checksystemctl status wismailand log in to web administration and webmail.
Messages that users deleted after the Full can reappear after a manual restore, because the restore does not replay deletions. Check a few mailboxes and the calendar before you put the server back into service. Restoring to a new server with a different license key needs the new key (license activation).
Test your backups
Once a month restore the newest Full into a test server and open a few mailboxes. A backup you have not restored is a guess. Also check the Last backup failed state and the notification emails.
Next steps
- Upgrade guide: run a Copy backup first.
- Administration guide
- Pricing or the free trial