Email is business-critical, and a mail server fails in all the usual ways: disks die, upgrades go wrong, someone deletes the wrong mailbox, ransomware encrypts the volume. A Carbonio backup plan decides whether any of that is an inconvenience or a disaster. This guide lists exactly what to protect on a Carbonio CE server, practical ways to back it up, how to restore and how to prove it works.
Important: Check What Your Edition Includes
Carbonio has a dedicated backup component in its commercial offering, and the upgrade documentation for CE refers to backing up before upgrades. However, we could not confirm from the Community Edition documentation that a built-in, supported backup module is included in CE. Check the current edition comparison from Zextras before you rely on any feature. The methods below do not depend on a built-in module: they use the operating system, the platform’s own utilities and standard tools. They work on any edition, and they are also good practice alongside a vendor tool.
What You Need to Protect
| Component | Why it matters | Where it lives |
|---|---|---|
| Mail and file data | The actual messages and attachments | The Carbonio store under /opt/zextras/store (check your volume layout) |
| Directory (LDAP) | Domains, accounts, aliases, classes of service, distribution lists | Dumped with zmslapcat |
| Local configuration | Server settings | /opt/zextras/conf/localconfig.xml |
| PostgreSQL databases | Files, Tasks, Preview, Chats and related metadata | PostgreSQL (carbonio_adm and component databases) |
| TLS certificates and keys | Required to restore service | /opt/zextras/ssl/ |
| DKIM keys | Stored in LDAP, but keep a record of selectors and DNS | LDAP and DNS |
| Mesh and service configuration | Needed to rejoin services | /var/lib/service-discover/ and related configuration (including the Mesh password file) |
| Operating system and repository setup | To rebuild quickly | /etc/apt/sources.list.d/zextras.list, /etc/hosts, firewall rules |
Zextras’ upgrade procedure itself tells you to dump LDAP and copy localconfig.xml before upgrading, which shows the minimum you need to preserve. A complete disaster-recovery backup needs more than that.
Carbonio Backup Strategy: The 3-2-1 Rule
- 3 copies of the data
- on 2 different kinds of storage
- with 1 copy off-site (and ideally immutable, so ransomware cannot delete it)
See also our general guide: How to Back Up a Linux Server.
Method 1: VM or Disk Snapshots (Fast Full-System Recovery)
If Carbonio runs on a VM (Proxmox, VMware, KVM, cloud), a snapshot of the whole disk captures everything in one step, and it is the quickest way to get back after a failed upgrade. Use it with care:
- A snapshot taken while services are running is crash-consistent, not application-consistent. Databases usually recover, but a clean result needs the services stopped or quiesced first
- Snapshots are not backups on their own, because they typically live on the same storage. Copy them off the host, or use a backup system such as Proxmox Backup Server
- Take a snapshot before every upgrade and keep it for a few days
IAMEM offers image-level VM backup; see our managed backup service.
Method 2: Application-Level Backup of Critical Data
Run these as part of a scheduled script. As the zextras user, dump the directory and copy the configuration:
su - zextras
mkdir -p /backup/carbonio/$(date +%F)
/opt/zextras/libexec/zmslapcat /backup/carbonio/$(date +%F)
cp /opt/zextras/conf/localconfig.xml /backup/carbonio/$(date +%F)/
Dump the PostgreSQL databases as the postgres user (adjust the list to the databases that exist on your server):
sudo -u postgres pg_dumpall > /backup/carbonio/$(date +%F)/postgres-all.sql
Copy the certificates and Mesh configuration, then copy the mail store with rsync:
tar czf /backup/carbonio/$(date +%F)/ssl.tgz /opt/zextras/ssl
rsync -aH --delete /opt/zextras/store/ backup-host:/backups/carbonio/store/
For the mail store, a copy taken while the system is busy can capture inconsistent data. For a consistent copy, stop Carbonio briefly, snapshot the volume (LVM, ZFS or Btrfs) and copy from the snapshot while services restart. Always follow the Zextras documentation for supported ways to stop and start services on your release; on Ubuntu 24.04 and RHEL 9 Carbonio uses systemd targets.
Keep several generations, encrypt backups that leave your control, and send them off the server. Check the size and date of each backup automatically and alert when it is missing. Schedule with cron (Cron Jobs Explained).
Method 3: Replication and a Warm Standby
For lower recovery time, keep a second server with the same Carbonio version and refresh it from the latest backup. A restore then becomes “switch DNS and bring the standby online”. This is more work and cost, but it is the next step if hours of downtime are unacceptable. A secondary MX will queue incoming mail while the primary is down.
Restoring: The Disaster Recovery Runbook
Write this down and keep a copy outside the mail server:
- Declare the incident and stop the damage. Isolate the server if it is compromised, and find out when the problem began so you pick a clean restore point
- Rebuild the platform. Provision a server with the same OS, hostname and IP. Re-create the repository and install the same Carbonio version as the backup, following our installation guide
- Restore LDAP and configuration. Restore the directory and
localconfig.xml, following the Zextras documentation for your version - Restore PostgreSQL databases from the dump
- Restore the mail store to the right paths with correct ownership
- Restore certificates and DKIM so TLS and signing work
- Start services and check Mesh status. Look at the service logs for errors
- Verify: sign in, open mailboxes, send and receive, check calendar and files
- Update DNS if the IP changed, and watch the mail queue
If you are restoring a VM snapshot, the steps are shorter: restore the snapshot, boot, verify services and check that mail received after the snapshot is not lost. Look at sender retries and the secondary MX for messages that arrived in the gap.
Test Your Recovery (Do Not Skip This)
A backup that has never been restored is a hope. Quarterly:
- Restore to an isolated test server and confirm the web interface, a sample of mailboxes and the directory
- Time the whole process so you know your real recovery time
- Record problems and fix the runbook
Before Every Upgrade
Zextras’ upgrade guide starts with a backup, LDAP dump and localconfig.xml copy. In addition:
- Take a VM snapshot
- Read the release notes for the target version
- Reply No if you are asked whether to replace
localconfig.xmlduring the upgrade, as the upgrade documentation instructs - Upgrade a test copy first if you can
Backup Checklist
- Mail store backed up on a schedule, with a consistent method
- LDAP dump and
localconfig.xmlsaved daily - PostgreSQL dumps saved daily
- Certificates and Mesh configuration saved
- Copies kept off-site and protected from deletion
- Backup success monitored with alerts
- Restore tested at least quarterly and documented
Frequently Asked Questions
Does Carbonio CE include a backup tool?
We could not confirm a built-in backup module in the Community Edition documentation, so plan for snapshots and application-level backups, and check the Zextras edition comparison.
Is a VM snapshot enough?
It is a fast recovery tool, but not a complete backup unless copied to separate storage. Combine it with application-level dumps and off-site copies.
How often should I back up a mail server?
Daily at minimum for the directory, database and configuration, and as often as your acceptable data-loss window requires for the mail store.
Can I restore a single deleted mailbox?
With file-level backups this is difficult. A restore to a spare server and an export of the mailbox is the usual approach, or a backup tool with item-level restore.
