]> git.proxmox.com Git - pmg-docs.git/blame - pmgbackup.adoc
asciidoc: make thumbnail path relative to images/
[pmg-docs.git] / pmgbackup.adoc
CommitLineData
aebeb2f5
DM
1[[chapter_pmgbackup]]
2ifdef::manvolnum[]
3pmgbackup(1)
4============
5:pmg-toplevel:
6
7NAME
8----
9
10pmgbackup - Proxmox Mail Gateway Backup and Restore Utility
11
12
13SYNOPSIS
14--------
15
16include::pmgbackup.1-synopsis.adoc[]
17
18DESCRIPTION
19-----------
20endif::manvolnum[]
21ifndef::manvolnum[]
22Backup and Restore
23==================
24:pmg-toplevel:
25endif::manvolnum[]
26
00a7fa74 27ifndef::manvolnum[]
38d14519 28[thumbnail="screenshot/pmg-gui-backup.png", big=1]
00a7fa74
DM
29endif::manvolnum[]
30
5565ff83 31{pmg} includes the ability to back up and restore the
00a7fa74 32configuration. This includes the complete config from `/etc/pmg/`, the
5565ff83 33mail filter rules, and the statistic database.
00a7fa74 34
5565ff83
DW
35NOTE: The backup does not include the network setup, nor does it
36contain mail data from the postfix queue or the spam and virus
37quarantines.
00a7fa74 38
18734510 39Backups can be created locally or stored on a
15dbf331 40https://www.proxmox.com/en/proxmox-backup-server/overview[Proxmox Backup Server]
18734510
SI
41instance.
42
43Local Backups
44-------------
45
46You can create a backup by simply pressing the 'Backup' button in the 'Local
db96e742 47Backup/Restore' tab on the GUI, or by using the command-line interface:
00a7fa74
DM
48
49----
50# pmgbackup backup
51starting backup to: /var/lib/pmg/backup/pmg-backup_2018_01_04_5A4E0436.tgz
52backup finished
53----
54
18734510 55Local backups are stored inside directory `/var/lib/pmg/backup/`. It is
00a7fa74
DM
56usually best to mount a remote file system to that directory, so that
57the resulting backups gets stored remotely.
58
59You can list the contents of that directory with:
60
61----
62# pmgbackup list
63....
64pmg-backup_2017_11_10_5A05D4B9.tgz 17012
65pmg-backup_2017_11_13_5A09676A.tgz 16831
66pmg-backup_2018_01_04_5A4E0436.tgz 21514
67----
68
69Restores are also possible using the GUI or command line, and you can
5565ff83 70select which parts you want to restore:
00a7fa74
DM
71
72System Configuration::
73
74Basically the contents of `/etc/pmg/`.
75
76Rule Database::
77
78The mail filter rule database.
79
80Statistic::
81
82All statistical data.
83
b86b6da3 84For example, you can selectively restore the mail filter rules from an
00a7fa74
DM
85older backup:
86
87----
88# pmgbackup restore --filename pmg-backup_2018_01_04_5A4E0436.tgz --database
89starting restore: /var/lib/pmg/backup/pmg-backup_2018_01_04_5A4E0436.tgz
90config_backup.tar: OK
91Proxmox_ruledb.sql: OK
92Proxmox_statdb.sql: OK
93version.txt: OK
94Destroy existing rule database
95Create new database
96run analyze to speed up database queries
97Analyzing/Upgrading existing Databases...done
98restore finished
99----
100
8faa93f4 101[[pmgbackup_pbs]]
18734510
SI
102Proxmox Backup Server
103---------------------
104
5565ff83
DW
105In order to back up your {pmg} configuration on a Proxmox Backup
106Server, you first need to configure the instance as a backup 'remote'.
107You can then directly create and restore backups, as well as create a
108scheduled 'backup job' to run regular backups.
18734510 109
8faa93f4 110[[pmgbackup_pbs_remotes]]
18734510
SI
111Remotes
112~~~~~~~
113
114ifndef::manvolnum[]
38d14519 115[thumbnail="screenshot/pmg-gui-pbs-remote.png"]
18734510
SI
116endif::manvolnum[]
117
c2763fd2 118
18734510
SI
119A Proxmox Backup Server remote can be configured using the 'Proxmox Backup
120Server' panel in the 'Backup/Restore' menu of the GUI, or by using the
c2763fd2
TL
121`remote` subcommand of `pmgbackup`.
122
123NOTE: You can use API Tokens in place of a username/password combination.
18734510 124
c2763fd2 125.Example addition of a Proxmox Backup Server remote with id 'archive'.
18734510 126----
c2763fd2 127# 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
18734510
SI
128Enter new password: ******
129Retype new password: ******
130----
131
c2763fd2
TL
132The fingerprint is optional, if the certificate of the Proxmox Backup Server
133remote is signed by a CA trusted by {pmg}.
18734510 134
5565ff83
DW
135Additionally, you can configure `prune-settings` for each remote, giving you
136flexible control over how many backups should be stored on the Proxmox Backup
137Server over a specific period of time.
18734510 138
c2763fd2 139.Setting the prune options for the Proxmox Backup Server remote with id 'archive'.
18734510 140----
c2763fd2 141# pmgbackup remote set archive --keep-last 3 --keep-daily 14 --keep-weekly 8 --keep-monthly 12 --keep-yearly 7
18734510 142----
c2763fd2 143
70808289 144If prune settings are configured, the backup-group of {pmg} is pruned
c2763fd2 145automatically after each successful backup.
18734510 146
5565ff83 147The `notify` and `include-statistics` settings of a remote define the defaults
f36ab7c1
SI
148for notifications and whether to include the statistic database in backups.
149They are also used for xref:pmgbackup_pbs_schedule[scheduled backups].
150
5565ff83 151The public settings are stored in `/etc/pmg/pbs/pbs.conf`. Sensitive settings,
18734510
SI
152like passwords are stored in individual files named after the remote inside
153`/etc/pmg/pbs/`:
154
155.Configuration Example (`/etc/pmg/pbs/pbs.conf`)
156----
c2763fd2 157pbs: archive
18734510
SI
158 datastore big
159 server backup.proxmox.com
160 fingerprint 09:54:ef:..snip..:88:af:47:fe:4c:3b:cf:8b:26:88:0b:4e:3c:b2
161 keep-daily 30
162 keep-last 5
163 keep-monthly 3
164 keep-yearly 5
165 username pmgbackup@pbs!token
166----
167
8faa93f4 168[[pmgbackup_pbs_jobs]]
18734510
SI
169Backup Jobs
170~~~~~~~~~~~
171
c2763fd2 172ifndef::manvolnum[]
38d14519 173[thumbnail="screenshot/pmg-gui-pbs-backup.png", big=1]
c2763fd2
TL
174endif::manvolnum[]
175
5565ff83 176With a configured remote, you can create backups using the GUI or the
c2763fd2 177`proxmox-backup backup` subcommand of the `pmgbackup` CLI tool.
18734510 178
c2763fd2 179.Creating a new backup on the Proxmox Backup Server remote with id 'archive'.
18734510 180----
c2763fd2 181# pmgbackup proxmox-backup backup archive
18734510
SI
182starting update of current backup state
183Starting backup: host/pmg/2020-11-16T16:38:39Z
184Client name: pmg
185Starting backup protocol: Mon Nov 16 16:38:39 2020
186Upload directory '/var/lib/pmg/backup/current' to 'pmgbackup@pbs!token@backup.proxmox.com:8007:local' as pmgbackup.pxar.didx
187pmgbackup.pxar: had to upload 188.33 KiB of 188.33 KiB in 0.00s, average speed 162.33 MiB/s).
188Uploaded backup catalog (145 B)
189Duration: 0.06s
190End Time: Mon Nov 16 16:38:39 2020
191backup finished
192starting prune of host/pmg
193prune finished
194----
195
5565ff83 196For restoring, you can optionally select a particular backup-snapshot to return
c2763fd2
TL
197to the state of configuration and rules at that time.
198
5565ff83 199From the command line, you can get a list of available backup snapshots using
c2763fd2
TL
200the `proxmox-backup list` subcommand:
201
202.Listing available backups from the Proxmox Backup Server remote with id 'archive'.
203----
204# pmgbackup proxmox-backup list archive
205┌────────────┬──────────────────────┬────────┐
206│ backup-id │ backup-time │ size │
207╞════════════╪══════════════════════╪════════╡
208│ pmg │ 2020-11-16T14:03:04Z │ 121910 │
209├────────────┼──────────────────────┼────────┤
210 ...
211└────────────┴──────────────────────┴────────┘
212----
18734510 213
c2763fd2 214.Restoring a specific backup snapshot
18734510 215----
c2763fd2 216# pmgbackup proxmox-backup restore archive pmg 2020-11-16T14:03:04Z
18734510
SI
217starting restore of host/pmg/2020-11-16T14:03:04Z from backup
218..snip..
219restore finished
220----
221
5565ff83
DW
222You can remove a particular snapshot by using the `forget` subcommand. This
223allows the Proxmox Backup Server to remove it during garbage collection.
18734510
SI
224
225----
c2763fd2 226# pmgbackup proxmox-backup forget archive pmg 2020-11-16T14:03:04Z
18734510
SI
227----
228
5565ff83 229TIP: You can configure and access all backup-related functionality on
db96e742 230both the web interface and the command-line interface.
c2763fd2 231
8faa93f4 232[[pmgbackup_pbs_schedule]]
18734510
SI
233Scheduled Backups
234^^^^^^^^^^^^^^^^^
235
236You can create a `Schedule` for each remote, to periodically create backups of
237your {pmg} - for example to run a daily backup at 03:50:00 with a randomized
238delay of 15 minutes each day:
239
240----
c2763fd2 241# pmgbackup proxmox-backup job create archive --schedule '*-*-* 03:50:00' --delay '15 minutes'
18734510
SI
242----
243
244The randomized delay can help to prevent load-peaks on the backup server, if
5565ff83 245you have multiple backups which should all start around the same time.
00a7fa74 246
5565ff83 247The schedules are `systemd.timer` units. See the `systemd.time(7)` man page for
18734510 248details on the time specification used.
aebeb2f5
DM
249
250
251ifdef::manvolnum[]
252include::pmg-copyright.adoc[]
253endif::manvolnum[]
254