10 pmgbackup - Proxmox Mail Gateway Backup and Restore Utility
16 include::pmgbackup.1-synopsis.adoc[]
28 [thumbnail="pmg-gui-backup.png", big=1]
31 {pmg} includes the ability to backup and restore the
32 configuration. This includes the complete config from `/etc/pmg/`, the
33 mail filter rules and the statistic database.
35 NOTE: The backup does not include the network setup, and also no mail
36 data from the postfix queue or the spam or virus quarantine.
38 Backups can be created locally or stored on a
39 https://www.proxmox.com/en/proxmox-backup-server[Proxmox Backup Server]
45 You can create a backup by simply pressing the 'Backup' button in the 'Local
46 Backup/Restore' tab on the GUI, or by using the command line interface:
50 starting backup to: /var/lib/pmg/backup/pmg-backup_2018_01_04_5A4E0436.tgz
54 Local backups are stored inside directory `/var/lib/pmg/backup/`. It is
55 usually best to mount a remote file system to that directory, so that
56 the resulting backups gets stored remotely.
58 You can list the contents of that directory with:
63 pmg-backup_2017_11_10_5A05D4B9.tgz 17012
64 pmg-backup_2017_11_13_5A09676A.tgz 16831
65 pmg-backup_2018_01_04_5A4E0436.tgz 21514
68 Restores are also possible using the GUI or command line, and you can
69 select what parts you want to restore:
71 System Configuration::
73 Basically the contents of `/etc/pmg/`.
77 The mail filter rule database.
83 For example, you can selectively restore the mail filter rules from an
87 # pmgbackup restore --filename pmg-backup_2018_01_04_5A4E0436.tgz --database
88 starting restore: /var/lib/pmg/backup/pmg-backup_2018_01_04_5A4E0436.tgz
90 Proxmox_ruledb.sql: OK
91 Proxmox_statdb.sql: OK
93 Destroy existing rule database
95 run analyze to speed up database queries
96 Analyzing/Upgrading existing Databases...done
100 Proxmox Backup Server
101 ---------------------
103 In order to backup your {pmg} configuration on a Proxmox Backup Server you
104 need configure the instance as backup 'remote'. You can then directly create
105 and restore backups, as well as create a scheduled 'backup job' to run
112 [thumbnail="pmg-gui-pbs-remote.png"]
116 A Proxmox Backup Server remote can be configured using the 'Proxmox Backup
117 Server' panel in the 'Backup/Restore' menu of the GUI, or by using the
118 `remote` subcommand of `pmgbackup`.
120 NOTE: You can use API Tokens in place of a username/password combination.
122 .Example addition of a Proxmox Backup Server remote with id 'archive'.
124 # pmgbackup proxmox-backup remote add archive --datastore big --server backup.proxmox.com --user 'pmgbackup@pbs!token' --password --fingerprint 09:54:ef:..snip..:88:af:47:fe:4c:3b:cf:8b:26:88:0b:4e:3c:b2
125 Enter new password: ******
126 Retype new password: ******
129 The fingerprint is optional, if the certificate of the Proxmox Backup Server
130 remote is signed by a CA trusted by {pmg}.
132 Additionally you can configure `prune-settings` for each remote, giving you
133 flexible control about how many backups should be stored on the Proxmox Backup
134 Server over a period of time.
136 .Setting the prune options for the Proxmox Backup Server remote with id 'archive'.
138 # pmgbackup remote set archive --keep-last 3 --keep-daily 14 --keep-weekly 8 --keep-monthly 12 --keep-yearly 7
141 If prune settigns are configured, the backup-group of {pmg} is pruned
142 automatically after each successful backup.
144 The public settings are stored in `/etc/pmg/pbs/pbs.conf`, sensitive settings,
145 like passwords are stored in individual files named after the remote inside
148 .Configuration Example (`/etc/pmg/pbs/pbs.conf`)
152 server backup.proxmox.com
153 fingerprint 09:54:ef:..snip..:88:af:47:fe:4c:3b:cf:8b:26:88:0b:4e:3c:b2
158 username pmgbackup@pbs!token
165 [thumbnail="pmg-gui-pbs-backup.png", big=1]
168 With a configured remote you can create backups using the GUI or the
169 `proxmox-backup backup` subcommand of the `pmgbackup` CLI tool.
171 .Creating a new backup on the Proxmox Backup Server remote with id 'archive'.
173 # pmgbackup proxmox-backup backup archive
174 starting update of current backup state
175 Starting backup: host/pmg/2020-11-16T16:38:39Z
177 Starting backup protocol: Mon Nov 16 16:38:39 2020
178 Upload directory '/var/lib/pmg/backup/current' to 'pmgbackup@pbs!token@backup.proxmox.com:8007:local' as pmgbackup.pxar.didx
179 pmgbackup.pxar: had to upload 188.33 KiB of 188.33 KiB in 0.00s, average speed 162.33 MiB/s).
180 Uploaded backup catalog (145 B)
182 End Time: Mon Nov 16 16:38:39 2020
184 starting prune of host/pmg
188 For restoring you can optionally select a particular backup-snapshot to return
189 to the state of configuration and rules at that time.
191 On the commandline you can get first a list of available backup snapshots using
192 the `proxmox-backup list` subcommand:
194 .Listing available backups from the Proxmox Backup Server remote with id 'archive'.
196 # pmgbackup proxmox-backup list archive
197 ┌────────────┬──────────────────────┬────────┐
198 │ backup-id │ backup-time │ size │
199 ╞════════════╪══════════════════════╪════════╡
200 │ pmg │ 2020-11-16T14:03:04Z │ 121910 │
201 ├────────────┼──────────────────────┼────────┤
203 └────────────┴──────────────────────┴────────┘
206 .Restoring a specific backup snapshot
208 # pmgbackup proxmox-backup restore archive pmg 2020-11-16T14:03:04Z
209 starting restore of host/pmg/2020-11-16T14:03:04Z from backup
214 You can remove a particular snapshot by using the `forget` sub command, this
215 allows the Proxmox Backup Server to pick it up during garbage collection.
218 # pmgbackup proxmox-backup forget archive pmg 2020-11-16T14:03:04Z
221 TIP: You can configure and access all backup related functionallity on both,
222 the web interface and the command line interface.
227 You can create a `Schedule` for each remote, to periodically create backups of
228 your {pmg} - for example to run a daily backup at 03:50:00 with a randomized
229 delay of 15 minutes each day:
232 # pmgbackup proxmox-backup job create archive --schedule '*-*-* 03:50:00' --delay '15 minutes'
235 The randomized delay can help to prevent load-peaks on the backup server, if
236 you have multiple backups, which all should start around the same time.
238 The schedules are `systemd.timer` units. See the `systemd.time(7)` man page for
239 details on the time specification used.
243 include::pmg-copyright.adoc[]