]>
Commit | Line | Data |
---|---|---|
24406ebc TL |
1 | Backup Management |
2 | ================= | |
7e688b71 | 3 | |
24406ebc TL |
4 | .. The administration guide. |
5 | .. todo:: either add a bit more explanation or remove the previous sentence | |
c4f1b69f | 6 | |
fea8789c DM |
7 | Terminology |
8 | ----------- | |
9 | ||
85e139b7 DM |
10 | Backup Content |
11 | ~~~~~~~~~~~~~~ | |
12 | ||
13 | When doing deduplication, there are different strategies to get | |
14 | optimal results in terms of performance and/or deduplication rates. | |
8c6e5ce2 | 15 | Depending on the type of data, it can be split into *fixed* or *variable* |
85e139b7 DM |
16 | sized chunks. |
17 | ||
8c6e5ce2 | 18 | Fixed sized chunking requires minimal CPU power, and is used to |
85e139b7 DM |
19 | backup virtual machine images. |
20 | ||
21 | Variable sized chunking needs more CPU power, but is essential to get | |
22 | good deduplication rates for file archives. | |
23 | ||
8c6e5ce2 | 24 | The Proxmox Backup Server supports both strategies. |
85e139b7 DM |
25 | |
26 | ||
57905a61 DM |
27 | File Archives: ``<name>.pxar`` |
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
85e139b7 DM |
29 | |
30 | .. see https://moinakg.wordpress.com/2013/06/22/high-performance-content-defined-chunking/ | |
31 | ||
4f3db187 | 32 | A file archive stores a full directory tree. Content is stored using |
8c6e5ce2 | 33 | the :ref:`pxar-format`, split into variable-sized chunks. The format |
4f3db187 | 34 | is optimized to achieve good deduplication rates. |
85e139b7 DM |
35 | |
36 | ||
57905a61 DM |
37 | Image Archives: ``<name>.img`` |
38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
85e139b7 DM |
39 | |
40 | This is used for virtual machine images and other large binary | |
8c6e5ce2 | 41 | data. Content is split into fixed-sized chunks. |
85e139b7 DM |
42 | |
43 | ||
44 | Binary Data (BLOBs) | |
45 | ^^^^^^^^^^^^^^^^^^^ | |
46 | ||
4f3db187 AL |
47 | This type is used to store smaller (< 16MB) binary data such as |
48 | configuration files. Larger files should be stored as image archive. | |
85e139b7 DM |
49 | |
50 | .. caution:: Please do not store all files as BLOBs. Instead, use the | |
51 | file archive to store whole directory trees. | |
52 | ||
53 | ||
57905a61 DM |
54 | Catalog File: ``catalog.pcat1`` |
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
56 | ||
4f3db187 | 57 | The catalog file is an index for file archives. It contains |
8c6e5ce2 | 58 | the list of files and is used to speed up search operations. |
57905a61 DM |
59 | |
60 | ||
61 | The Manifest: ``index.json`` | |
62 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
63 | ||
4f3db187 AL |
64 | The manifest contains the list of all backup files, their |
65 | sizes and checksums. It is used to verify the consistency of a | |
57905a61 DM |
66 | backup. |
67 | ||
68 | ||
fea8789c DM |
69 | Backup Type |
70 | ~~~~~~~~~~~ | |
71 | ||
72 | The backup server groups backups by *type*, where *type* is one of: | |
73 | ||
74 | ``vm`` | |
a129fdd9 | 75 | This type is used for :term:`virtual machine`\ s. Typically |
8c6e5ce2 | 76 | consists of the virtual machine's configuration file and an image archive |
fea8789c DM |
77 | for each disk. |
78 | ||
79 | ``ct`` | |
8c6e5ce2 OB |
80 | This type is used for :term:`container`\ s. Consists of the container's |
81 | configuration and a single file archive for the filesystem content. | |
fea8789c DM |
82 | |
83 | ``host`` | |
4f3db187 AL |
84 | This type is used for backups created from within the backed up machine. |
85 | Typically this would be a physical host but could also be a virtual machine | |
86 | or container. Such backups may contain file and image archives, there are no restrictions in this regard. | |
fea8789c DM |
87 | |
88 | ||
89 | Backup ID | |
90 | ~~~~~~~~~ | |
91 | ||
8c6e5ce2 | 92 | A unique ID. Usually the virtual machine or container ID. ``host`` |
fea8789c DM |
93 | type backups normally use the hostname. |
94 | ||
95 | ||
96 | Backup Time | |
97 | ~~~~~~~~~~~ | |
98 | ||
99 | The time when the backup was made. | |
100 | ||
101 | ||
6e5a0c03 DM |
102 | Backup Group |
103 | ~~~~~~~~~~~~ | |
104 | ||
4f3db187 AL |
105 | The tuple ``<type>/<ID>`` is called a backup group. Such a group |
106 | may contain one or more backup snapshots. | |
6e5a0c03 DM |
107 | |
108 | ||
fea8789c DM |
109 | Backup Snapshot |
110 | ~~~~~~~~~~~~~~~ | |
111 | ||
4f3db187 | 112 | The triplet ``<type>/<ID>/<time>`` is called a backup snapshot. It |
fea8789c DM |
113 | uniquely identifies a specific backup within a datastore. |
114 | ||
115 | .. code-block:: console | |
116 | :caption: Backup Snapshot Examples | |
117 | ||
118 | vm/104/2019-10-09T08:01:06Z | |
119 | host/elsa/2019-11-08T09:48:14Z | |
120 | ||
4f3db187 | 121 | As you can see, the time format is RFC3399_ with Coordinated |
fea8789c DM |
122 | Universal Time (UTC_, identified by the trailing *Z*). |
123 | ||
8c6e5ce2 OB |
124 | Backup Server Management |
125 | ------------------------ | |
126 | ||
127 | The command line tool to configure and manage the backup server is called | |
128 | :command:`proxmox-backup-manager`. | |
129 | ||
130 | ||
fea8789c DM |
131 | |
132 | :term:`DataStore` | |
133 | ~~~~~~~~~~~~~~~~~ | |
134 | ||
4f3db187 | 135 | A datastore is a place where backups are stored. The current implementation |
fea8789c | 136 | uses a directory inside a standard unix file system (``ext4``, ``xfs`` |
4f3db187 | 137 | or ``zfs``) to store the backup data. |
fea8789c | 138 | |
4f3db187 | 139 | Datastores are identified by a simple *ID*. You can configure it |
fea8789c DM |
140 | when setting up the backup server. |
141 | ||
538c2b6d TL |
142 | .. note:: The `File Layout`_ requires the file system to support at least *65538* |
143 | subdirectories per directory. That number comes from the 2\ :sup:`16` | |
144 | pre-created chunk namespace directories, and the ``.`` and ``..`` default | |
145 | directory entries. This requirement excludes certain filesystems and | |
146 | filesystem configuration from being supported for a datastore. For example, | |
147 | ``ext3`` as a whole or ``ext4`` with the ``dir_nlink`` feature manually disabled. | |
fea8789c | 148 | |
58ea88c8 DM |
149 | |
150 | Datastore Configuration | |
151 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
152 | ||
8c6e5ce2 OB |
153 | You can configure multiple datastores. Minimum one datastore needs to be |
154 | configured. The datastore is identified by a simple `name` and points to a | |
22231524 SI |
155 | directory on the filesystem. Each datastore also has associated retention |
156 | settings of how many backup snapshots for each interval of ``hourly``, | |
aef49768 | 157 | ``daily``, ``weekly``, ``monthly``, ``yearly`` as well as a time-independent |
22231524 SI |
158 | number of backups to keep in that store. :ref:`Pruning <pruning>` and |
159 | :ref:`garbage collection <garbage-collection>` can also be configured to run | |
160 | periodically based on a configured :term:`schedule` per datastore. | |
58ea88c8 DM |
161 | |
162 | The following command creates a new datastore called ``store1`` on :file:`/backup/disk1/store1` | |
163 | ||
164 | .. code-block:: console | |
165 | ||
166 | # proxmox-backup-manager datastore create store1 /backup/disk1/store1 | |
167 | ||
4f3db187 | 168 | To list existing datastores run: |
58ea88c8 DM |
169 | |
170 | .. code-block:: console | |
171 | ||
172 | # proxmox-backup-manager datastore list | |
17ec699d DM |
173 | ┌────────┬──────────────────────┬─────────────────────────────┐ |
174 | │ name │ path │ comment │ | |
175 | ╞════════╪══════════════════════╪═════════════════════════════╡ | |
176 | │ store1 │ /backup/disk1/store1 │ This is my default storage. │ | |
177 | └────────┴──────────────────────┴─────────────────────────────┘ | |
58ea88c8 | 178 | |
22231524 SI |
179 | You can change settings of a datastore, for example to set a prune and garbage |
180 | collection schedule or retention settings using ``update`` subcommand and view | |
181 | a datastore with the ``show`` subcommand: | |
182 | ||
183 | .. code-block:: console | |
184 | ||
185 | # proxmox-backup-manager datastore update store1 --keep-last 7 --prune-schedule daily --gc-schedule 'Tue 04:27' | |
186 | # proxmox-backup-manager datastore show store1 | |
187 | ┌────────────────┬─────────────────────────────┐ | |
188 | │ Name │ Value │ | |
189 | ╞════════════════╪═════════════════════════════╡ | |
190 | │ name │ store1 │ | |
191 | ├────────────────┼─────────────────────────────┤ | |
192 | │ path │ /backup/disk1/store1 │ | |
193 | ├────────────────┼─────────────────────────────┤ | |
194 | │ comment │ This is my default storage. │ | |
195 | ├────────────────┼─────────────────────────────┤ | |
196 | │ gc-schedule │ Tue 04:27 │ | |
197 | ├────────────────┼─────────────────────────────┤ | |
198 | │ keep-last │ 7 │ | |
199 | ├────────────────┼─────────────────────────────┤ | |
200 | │ prune-schedule │ daily │ | |
201 | └────────────────┴─────────────────────────────┘ | |
202 | ||
4f3db187 | 203 | Finally, it is possible to remove the datastore configuration: |
58ea88c8 DM |
204 | |
205 | .. code-block:: console | |
206 | ||
207 | # proxmox-backup-manager datastore remove store1 | |
208 | ||
4f3db187 | 209 | .. note:: The above command removes only the datastore configuration. It does |
58ea88c8 DM |
210 | not delete any data from the underlying directory. |
211 | ||
212 | ||
fea8789c DM |
213 | File Layout |
214 | ^^^^^^^^^^^ | |
215 | ||
8c6e5ce2 OB |
216 | After creating a datastore, the following default layout will appear: |
217 | ||
218 | .. code-block:: console | |
24406ebc | 219 | |
8c6e5ce2 OB |
220 | # ls -arilh /backup/disk1/store1 |
221 | 276493 -rw-r--r-- 1 backup backup 0 Jul 8 12:35 .lock | |
222 | 276490 drwxr-x--- 1 backup backup 1064960 Jul 8 12:35 .chunks | |
223 | ||
224 | `.lock` is an empty file used for process locking. | |
225 | ||
226 | The `.chunks` directory contains folders, starting from `0000` and taking hexadecimal values until `ffff`. These | |
227 | directories will store the chunked data after a backup operation has been executed. | |
228 | ||
229 | .. code-block:: console | |
24406ebc | 230 | |
8c6e5ce2 OB |
231 | # ls -arilh /backup/disk1/store1/.chunks |
232 | 545824 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 ffff | |
233 | 545823 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffe | |
234 | 415621 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffd | |
235 | 415620 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffc | |
236 | 353187 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffb | |
237 | 344995 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffa | |
238 | 144079 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff9 | |
239 | 144078 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff8 | |
240 | 144077 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff7 | |
241 | ... | |
242 | 403180 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000c | |
243 | 403179 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000b | |
244 | 403177 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000a | |
245 | 402530 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0009 | |
246 | 402513 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0008 | |
247 | 402509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0007 | |
248 | 276509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0006 | |
249 | 276508 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0005 | |
250 | 276507 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0004 | |
251 | 276501 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0003 | |
252 | 276499 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0002 | |
253 | 276498 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0001 | |
254 | 276494 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0000 | |
255 | 276489 drwxr-xr-x 3 backup backup 4.0K Jul 8 12:35 .. | |
256 | 276490 drwxr-x--- 1 backup backup 1.1M Jul 8 12:35 . | |
257 | ||
fea8789c DM |
258 | |
259 | ||
17ec699d DM |
260 | User Management |
261 | ~~~~~~~~~~~~~~~ | |
262 | ||
8c6e5ce2 | 263 | Proxmox Backup Server supports several authentication realms, and you need to |
17ec699d DM |
264 | choose the realm when you add a new user. Possible realms are: |
265 | ||
266 | :pam: Linux PAM standard authentication. Use this if you want to | |
8c6e5ce2 | 267 | authenticate as Linux system user (Users need to exist on the |
17ec699d DM |
268 | system). |
269 | ||
270 | :pbs: Proxmox Backup Server realm. This type stores hashed passwords in | |
271 | ``/etc/proxmox-backup/shadow.json``. | |
272 | ||
273 | After installation, there is a single user ``root@pam``, which | |
274 | corresponds to the Unix superuser. You can use the | |
275 | ``proxmox-backup-manager`` command line tool to list or manipulate | |
276 | users: | |
277 | ||
278 | .. code-block:: console | |
279 | ||
280 | # proxmox-backup-manager user list | |
26d29e0e DM |
281 | ┌─────────────┬────────┬────────┬───────────┬──────────┬────────────────┬────────────────────┐ |
282 | │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │ | |
283 | ╞═════════════╪════════╪════════╪═══════════╪══════════╪════════════════╪════════════════════╡ | |
284 | │ root@pam │ 1 │ │ │ │ │ Superuser │ | |
285 | └─────────────┴────────┴────────┴───────────┴──────────┴────────────────┴────────────────────┘ | |
17ec699d DM |
286 | |
287 | The superuser has full administration rights on everything, so you | |
288 | normally want to add other users with less privileges: | |
289 | ||
290 | .. code-block:: console | |
291 | ||
292 | # proxmox-backup-manager user create john@pbs --email john@example.com | |
293 | ||
8c6e5ce2 OB |
294 | The create command lets you specify many options like ``--email`` or |
295 | ``--password``. You can update or change any of them using the | |
17ec699d DM |
296 | update command later: |
297 | ||
298 | .. code-block:: console | |
299 | ||
300 | # proxmox-backup-manager user update john@pbs --firstname John --lastname Smith | |
301 | # proxmox-backup-manager user update john@pbs --comment "An example user." | |
302 | ||
17ec699d DM |
303 | .. todo:: Mention how to set password without passing plaintext password as cli argument. |
304 | ||
305 | ||
8c6e5ce2 | 306 | The resulting user list looks like this: |
17ec699d DM |
307 | |
308 | .. code-block:: console | |
309 | ||
310 | # proxmox-backup-manager user list | |
311 | ┌──────────┬────────┬────────┬───────────┬──────────┬──────────────────┬──────────────────┐ | |
312 | │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │ | |
313 | ╞══════════╪════════╪════════╪═══════════╪══════════╪══════════════════╪══════════════════╡ | |
314 | │ john@pbs │ 1 │ │ John │ Smith │ john@example.com │ An example user. │ | |
315 | ├──────────┼────────┼────────┼───────────┼──────────┼──────────────────┼──────────────────┤ | |
316 | │ root@pam │ 1 │ │ │ │ │ Superuser │ | |
317 | └──────────┴────────┴────────┴───────────┴──────────┴──────────────────┴──────────────────┘ | |
318 | ||
8c6e5ce2 | 319 | Newly created users do not have any permissions. Please read the next |
17ec699d DM |
320 | section to learn how to set access permissions. |
321 | ||
8c6e5ce2 | 322 | If you want to disable a user account, you can do that by setting ``--enable`` to ``0`` |
8f3b3cc1 DM |
323 | |
324 | .. code-block:: console | |
325 | ||
326 | # proxmox-backup-manager user update john@pbs --enable 0 | |
327 | ||
8c6e5ce2 | 328 | Or completely remove the user with: |
8f3b3cc1 DM |
329 | |
330 | .. code-block:: console | |
331 | ||
332 | # proxmox-backup-manager user remove john@pbs | |
333 | ||
334 | ||
17ec699d DM |
335 | Access Control |
336 | ~~~~~~~~~~~~~~ | |
337 | ||
8c6e5ce2 OB |
338 | By default new users do not have any permission. Instead you need to |
339 | specify what is allowed and what is not. You can do this by assigning | |
8df51d48 DM |
340 | roles to users on specific objects like datastores or remotes. The |
341 | following roles exist: | |
342 | ||
8c6e5ce2 OB |
343 | **NoAccess** |
344 | Disable Access - nothing is allowed. | |
345 | ||
8df51d48 | 346 | **Admin** |
4cda7603 | 347 | Can do anything. |
8df51d48 DM |
348 | |
349 | **Audit** | |
4cda7603 | 350 | Can view things, but is not allowed to change settings. |
8df51d48 | 351 | |
8df51d48 DM |
352 | **DatastoreAdmin** |
353 | Can do anything on datastores. | |
354 | ||
355 | **DatastoreAudit** | |
356 | Can view datastore settings and list content. But | |
357 | is not allowed to read the actual data. | |
358 | ||
74fc8447 | 359 | **DatastoreReader** |
8df51d48 DM |
360 | Can Inspect datastore content and can do restores. |
361 | ||
74fc8447 | 362 | **DatastoreBackup** |
8df51d48 DM |
363 | Can backup and restore owned backups. |
364 | ||
365 | **DatastorePowerUser** | |
366 | Can backup, restore, and prune owned backups. | |
367 | ||
368 | **RemoteAdmin** | |
369 | Can do anything on remotes. | |
370 | ||
371 | **RemoteAudit** | |
372 | Can view remote settings. | |
373 | ||
374 | **RemoteSyncOperator** | |
375 | Is allowed to read data from a remote. | |
376 | ||
1e68497c DW |
377 | You can use the ``acl`` subcommand to manage and monitor user permissions. For |
378 | example, the command below will add the user ``john@pbs`` as a | |
379 | **DatastoreAdmin** for the data store ``store1``, located at ``/backup/disk1/store1``: | |
380 | ||
381 | .. code-block:: console | |
382 | ||
383 | # proxmox-backup-manager acl update /datastore/store1 DatastoreAdmin --userid john@pbs | |
384 | ||
385 | You can monitor the roles of each user using the following command: | |
386 | ||
387 | .. code-block:: console | |
388 | ||
389 | # proxmox-backup-manager acl list | |
390 | ┌──────────┬──────────────────┬───────────┬────────────────┐ | |
391 | │ ugid │ path │ propagate │ roleid │ | |
392 | ╞══════════╪══════════════════╪═══════════╪════════════════╡ | |
393 | │ john@pbs │ /datastore/disk1 │ 1 │ DatastoreAdmin │ | |
394 | └──────────┴──────────────────┴───────────┴────────────────┘ | |
395 | ||
396 | A single user can be assigned multiple permission sets for different data stores. | |
397 | ||
398 | .. Note:: | |
399 | Naming convention is important here. For data stores on the host, | |
400 | you must use the convention ``/datastore/{storename}``. For example, to set | |
401 | permissions for a data store mounted at ``/mnt/backup/disk4/store2``, you would use | |
402 | ``/datastore/store2`` for the path. For remote stores, use the convention | |
403 | ``/remote/{remote}/{storename}``, where ``{remote}`` signifies the name of the | |
404 | remote (see `Remote` below) and ``{storename}`` is the name of the data store on | |
405 | the remote. | |
17ec699d | 406 | |
9634ca07 SI |
407 | :term:`Remote` |
408 | ~~~~~~~~~~~~~~ | |
409 | ||
aef49768 | 410 | A remote refers to a separate Proxmox Backup Server installation and a user on that |
9634ca07 SI |
411 | installation, from which you can `sync` datastores to a local datastore with a |
412 | `Sync Job`. | |
413 | ||
aef49768 DW |
414 | To add a remote, you need its hostname or ip, a userid and password on the |
415 | remote, and its certificate fingerprint. To get the fingerprint, use the | |
416 | ``proxmox-backup-manager cert info`` command on the remote. | |
9634ca07 SI |
417 | |
418 | .. code-block:: console | |
419 | ||
420 | # proxmox-backup-manager cert info |grep Fingerprint | |
421 | Fingerprint (sha256): 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe | |
422 | ||
aef49768 | 423 | Using the information specified above, add the remote with: |
9634ca07 SI |
424 | |
425 | .. code-block:: console | |
426 | ||
427 | # proxmox-backup-manager remote create pbs2 --host pbs2.mydomain.example --userid sync@pam --password 'SECRET' --fingerprint 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe | |
428 | ||
429 | Use the ``list``, ``show``, ``update``, ``remove`` subcommands of | |
430 | ``proxmox-backup-manager remote`` to manage your remotes: | |
431 | ||
432 | .. code-block:: console | |
433 | ||
434 | # proxmox-backup-manager remote update pbs2 --host pbs2.example | |
435 | # proxmox-backup-manager remote list | |
436 | ┌──────┬──────────────┬──────────┬───────────────────────────────────────────┬─────────┐ | |
437 | │ name │ host │ userid │ fingerprint │ comment │ | |
438 | ╞══════╪══════════════╪══════════╪═══════════════════════════════════════════╪═════════╡ | |
439 | │ pbs2 │ pbs2.example │ sync@pam │64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe │ │ | |
440 | └──────┴──────────────┴──────────┴───────────────────────────────────────────┴─────────┘ | |
441 | # proxmox-backup-manager remote remove pbs2 | |
442 | ||
443 | ||
444 | Sync Jobs | |
445 | ~~~~~~~~~ | |
446 | ||
447 | Sync jobs are configured to pull the contents of a datastore on a `Remote` to a | |
448 | local datastore. You can either start the sync job manually on the GUI or | |
449 | provide it with a :term:`schedule` to run regularly. The | |
450 | ``proxmox-backup-manager sync-job`` command is used to manage sync jobs: | |
451 | ||
452 | .. code-block:: console | |
453 | ||
454 | # proxmox-backup-manager sync-job create pbs2-local --remote pbs2 --remote-store local --store local --schedule 'Wed 02:30' | |
455 | # proxmox-backup-manager sync-job update pbs2-local --comment 'offsite' | |
456 | # proxmox-backup-manager sync-job list | |
457 | ┌────────────┬───────┬────────┬──────────────┬───────────┬─────────┐ | |
458 | │ id │ store │ remote │ remote-store │ schedule │ comment │ | |
459 | ╞════════════╪═══════╪════════╪══════════════╪═══════════╪═════════╡ | |
460 | │ pbs2-local │ local │ pbs2 │ local │ Wed 02:30 │ offsite │ | |
461 | └────────────┴───────┴────────┴──────────────┴───────────┴─────────┘ | |
462 | # proxmox-backup-manager sync-job remove pbs2-local | |
463 | ||
464 | ||
cb01363c DM |
465 | Backup Client usage |
466 | ------------------- | |
58ea88c8 DM |
467 | |
468 | The command line client is called :command:`proxmox-backup-client`. | |
469 | ||
a129fdd9 | 470 | |
0c1c492d TL |
471 | Repository Locations |
472 | ~~~~~~~~~~~~~~~~~~~~ | |
58ea88c8 | 473 | |
4f3db187 | 474 | The client uses the following notation to specify a datastore repository |
58ea88c8 DM |
475 | on the backup server. |
476 | ||
477 | [[username@]server:]datastore | |
478 | ||
8c6e5ce2 OB |
479 | The default value for ``username`` ist ``root``. If no server is specified, |
480 | the default is the local host (``localhost``). | |
58ea88c8 | 481 | |
4f3db187 AL |
482 | You can pass the repository with the ``--repository`` command |
483 | line option, or by setting the ``PBS_REPOSITORY`` environment | |
58ea88c8 DM |
484 | variable. |
485 | ||
486 | ||
487 | Environment Variables | |
53ea6556 | 488 | ~~~~~~~~~~~~~~~~~~~~~ |
58ea88c8 DM |
489 | |
490 | ``PBS_REPOSITORY`` | |
491 | The default backup repository. | |
492 | ||
493 | ``PBS_PASSWORD`` | |
494 | When set, this value is used for the password required for the | |
495 | backup server. | |
496 | ||
497 | ``PBS_ENCRYPTION_PASSWORD`` | |
58ea88c8 DM |
498 | When set, this value is used to access the secret encryption key (if |
499 | protected by password). | |
500 | ||
3243f93c DM |
501 | ``PBS_FINGERPRINT`` When set, this value is used to verify the server |
502 | certificate (only used if the system CA certificates cannot | |
503 | validate the certificate). | |
504 | ||
53ea6556 DM |
505 | |
506 | Output Format | |
507 | ~~~~~~~~~~~~~ | |
508 | ||
4f3db187 AL |
509 | Most commands support the ``--output-format`` parameter. It accepts |
510 | the following values: | |
53ea6556 DM |
511 | |
512 | :``text``: Text format (default). Structured data is rendered as a table. | |
513 | ||
514 | :``json``: JSON (single line). | |
515 | ||
516 | :``json-pretty``: JSON (multiple lines, nicely formatted). | |
517 | ||
518 | ||
519 | Please use the following environment variables to modify output behavior: | |
520 | ||
521 | ``PROXMOX_OUTPUT_FORMAT`` | |
522 | Defines the default output format. | |
523 | ||
524 | ``PROXMOX_OUTPUT_NO_BORDER`` | |
525 | If set (to any value), do not render table borders. | |
526 | ||
527 | ``PROXMOX_OUTPUT_NO_HEADER`` | |
528 | If set (to any value), do not render table headers. | |
529 | ||
4f3db187 | 530 | .. note:: The ``text`` format is designed to be human readable, and |
53ea6556 | 531 | not meant to be parsed by automation tools. Please use the ``json`` |
4f3db187 | 532 | format if you need to process the output. |
53ea6556 DM |
533 | |
534 | ||
cee53b34 | 535 | .. _creating-backups: |
58ea88c8 DM |
536 | |
537 | Creating Backups | |
538 | ~~~~~~~~~~~~~~~~ | |
539 | ||
4f3db187 AL |
540 | This section explains how to create a backup from within the machine. This can |
541 | be a physical host, a virtual machine, or a container. Such backups may contain file | |
542 | and image archives. There are no restrictions in this case. | |
a129fdd9 | 543 | |
8c6e5ce2 | 544 | .. note:: If you want to backup virtual machines or containers on Proxmox VE, see :ref:`pve-integration`. |
a129fdd9 | 545 | |
4f3db187 AL |
546 | For the following example you need to have a backup server set up, working |
547 | credentials and need to know the repository name. | |
548 | In the following examples we use ``backup-server:store1``. | |
a129fdd9 DM |
549 | |
550 | .. code-block:: console | |
551 | ||
552 | # proxmox-backup-client backup root.pxar:/ --repository backup-server:store1 | |
553 | Starting backup: host/elsa/2019-12-03T09:35:01Z | |
554 | Client name: elsa | |
555 | skip mount point: "/boot/efi" | |
556 | skip mount point: "/dev" | |
557 | skip mount point: "/run" | |
558 | skip mount point: "/sys" | |
559 | Uploaded 12129 chunks in 87 seconds (564 MB/s). | |
560 | End Time: 2019-12-03T10:36:29+01:00 | |
561 | ||
562 | This will prompt you for a password and then uploads a file archive named | |
563 | ``root.pxar`` containing all the files in the ``/`` directory. | |
564 | ||
4f3db187 | 565 | .. Caution:: Please note that the proxmox-backup-client does not |
ed858b0a | 566 | automatically include mount points. Instead, you will see a short |
4f3db187 AL |
567 | ``skip mount point`` notice for each of them. The idea is to |
568 | create a separate file archive for each mounted disk. You can | |
a129fdd9 DM |
569 | explicitly include them using the ``--include-dev`` option |
570 | (i.e. ``--include-dev /boot/efi``). You can use this option | |
4f3db187 | 571 | multiple times for each mount point that should be included. |
a129fdd9 | 572 | |
4f3db187 | 573 | The ``--repository`` option can get quite long and is used by all |
a129fdd9 | 574 | commands. You can avoid having to enter this value by setting the |
74fc8447 DW |
575 | environment variable ``PBS_REPOSITORY``. Note that if you would like this to remain set |
576 | over multiple sessions, you should instead add the below line to your | |
577 | ``.bashrc`` file. | |
a129fdd9 DM |
578 | |
579 | .. code-block:: console | |
580 | ||
78ee20d7 | 581 | # export PBS_REPOSITORY=backup-server:store1 |
a129fdd9 | 582 | |
4f3db187 | 583 | After this you can execute all commands without specifying the ``--repository`` |
a129fdd9 DM |
584 | option. |
585 | ||
4f3db187 AL |
586 | One single backup is allowed to contain more than one archive. For example, if |
587 | you want to backup two disks mounted at ``/mmt/disk1`` and ``/mnt/disk2``: | |
a129fdd9 DM |
588 | |
589 | .. code-block:: console | |
590 | ||
591 | # proxmox-backup-client backup disk1.pxar:/mnt/disk1 disk2.pxar:/mnt/disk2 | |
592 | ||
4f3db187 | 593 | This creates a backup of both disks. |
a129fdd9 DM |
594 | |
595 | The backup command takes a list of backup specifications, which | |
4f3db187 AL |
596 | include the archive name on the server, the type of the archive, and the |
597 | archive source at the client. The format is: | |
a129fdd9 DM |
598 | |
599 | <archive-name>.<type>:<source-path> | |
600 | ||
601 | Common types are ``.pxar`` for file archives, and ``.img`` for block | |
4f3db187 | 602 | device images. To create a backup of a block device run the following command: |
a129fdd9 DM |
603 | |
604 | .. code-block:: console | |
605 | ||
606 | # proxmox-backup-client backup mydata.img:/dev/mylvm/mydata | |
607 | ||
50b8f9dd CE |
608 | Excluding files/folders from a backup |
609 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
610 | ||
611 | Sometimes it is desired to exclude certain files or folders from a backup archive. | |
4cda7603 | 612 | To tell the Proxmox Backup client when and how to ignore files and directories, |
4f3db187 AL |
613 | place a text file called ``.pxarexclude`` in the filesystem hierarchy. |
614 | Whenever the backup client encounters such a file in a directory, it interprets | |
615 | each line as glob match patterns for files and directories that are to be excluded | |
616 | from the backup. | |
617 | ||
618 | The file must contain a single glob pattern per line. Empty lines are ignored. | |
619 | The same is true for lines starting with ``#``, which indicates a comment. | |
620 | A ``!`` at the beginning of a line reverses the glob match pattern from an exclusion | |
621 | to an explicit inclusion. This makes it possible to exclude all entries in a | |
622 | directory except for a few single files/subdirectories. | |
623 | Lines ending in ``/`` match only on directories. | |
624 | The directory containing the ``.pxarexclude`` file is considered to be the root of | |
625 | the given patterns. It is only possible to match files in this directory and its subdirectories. | |
626 | ||
627 | ``\`` is used to escape special glob characters. | |
628 | ``?`` matches any single character. | |
629 | ``*`` matches any character, including an empty string. | |
630 | ``**`` is used to match subdirectories. It can be used to, for example, exclude | |
631 | all files ending in ``.tmp`` within the directory or subdirectories with the | |
50b8f9dd CE |
632 | following pattern ``**/*.tmp``. |
633 | ``[...]`` matches a single character from any of the provided characters within | |
0c1c492d | 634 | the brackets. ``[!...]`` does the complementary and matches any single character |
4f3db187 AL |
635 | not contained within the brackets. It is also possible to specify ranges with two |
636 | characters separated by ``-``. For example, ``[a-z]`` matches any lowercase | |
637 | alphabetic character and ``[0-9]`` matches any one single digit. | |
50b8f9dd | 638 | |
aef49768 DW |
639 | The order of the glob match patterns defines whether a file is included or |
640 | excluded, that is to say later entries override previous ones. | |
50b8f9dd | 641 | This is also true for match patterns encountered deeper down the directory tree, |
4f3db187 AL |
642 | which can override a previous exclusion. |
643 | Be aware that excluded directories will **not** be read by the backup client. | |
aef49768 | 644 | Thus, a ``.pxarexclude`` file in an excluded subdirectory will have no effect. |
4f3db187 | 645 | ``.pxarexclude`` files are treated as regular files and will be included in the |
50b8f9dd CE |
646 | backup archive. |
647 | ||
4f3db187 | 648 | For example, consider the following directory structure: |
50b8f9dd CE |
649 | |
650 | .. code-block:: console | |
651 | ||
652 | # ls -aR folder | |
653 | folder/: | |
654 | . .. .pxarexclude subfolder0 subfolder1 | |
655 | ||
656 | folder/subfolder0: | |
657 | . .. file0 file1 file2 file3 .pxarexclude | |
658 | ||
659 | folder/subfolder1: | |
660 | . .. file0 file1 file2 file3 | |
661 | ||
4f3db187 | 662 | The different ``.pxarexclude`` files contain the following: |
50b8f9dd CE |
663 | |
664 | .. code-block:: console | |
665 | ||
666 | # cat folder/.pxarexclude | |
667 | /subfolder0/file1 | |
668 | /subfolder1/* | |
669 | !/subfolder1/file2 | |
670 | ||
671 | .. code-block:: console | |
672 | ||
673 | # cat folder/subfolder0/.pxarexclude | |
674 | file3 | |
675 | ||
676 | This would exclude ``file1`` and ``file3`` in ``subfolder0`` and all of | |
677 | ``subfolder1`` except ``file2``. | |
678 | ||
4f3db187 | 679 | Restoring this backup will result in: |
50b8f9dd CE |
680 | |
681 | .. code-block:: console | |
682 | ||
683 | ls -aR restored | |
684 | restored/: | |
685 | . .. .pxarexclude subfolder0 subfolder1 | |
686 | ||
687 | restored/subfolder0: | |
688 | . .. file0 file2 .pxarexclude | |
689 | ||
690 | restored/subfolder1: | |
691 | . .. file2 | |
a129fdd9 | 692 | |
58ea88c8 | 693 | Encryption |
747c3bc0 | 694 | ~~~~~~~~~~ |
58ea88c8 | 695 | |
aef49768 DW |
696 | Proxmox Backup supports client-side encryption with AES-256 in GCM_ |
697 | mode. To set this up, you first need to create an encryption key: | |
5a499f32 DM |
698 | |
699 | .. code-block:: console | |
700 | ||
701 | # proxmox-backup-client key create my-backup.key | |
702 | Encryption Key Password: ************** | |
703 | ||
704 | The key is password protected by default. If you do not need this | |
705 | extra protection, you can also create it without a password: | |
706 | ||
707 | .. code-block:: console | |
708 | ||
4f3db187 | 709 | # proxmox-backup-client key create /path/to/my-backup.key --kdf none |
5a499f32 | 710 | |
16a18dad DW |
711 | Having created this key, it is now possible to create an encrypted backup, by |
712 | passing the ``--keyfile`` parameter, with the path to the key file. | |
5a499f32 DM |
713 | |
714 | .. code-block:: console | |
715 | ||
716 | # proxmox-backup-client backup etc.pxar:/etc --keyfile /path/to/my-backup.key | |
717 | Password: ********* | |
718 | Encryption Key Password: ************** | |
719 | ... | |
720 | ||
16a18dad DW |
721 | .. Note:: If you do not specify the name of the backup key, the key will be |
722 | created in the default location | |
723 | ``~/.config/proxmox-backup/encryption-key.json``. ``proxmox-backup-client`` | |
724 | will also search this location by default, in case the ``--keyfile`` | |
725 | parameter is not specified. | |
5a499f32 | 726 | |
4f3db187 | 727 | You can avoid entering the passwords by setting the environment |
5a499f32 DM |
728 | variables ``PBS_PASSWORD`` and ``PBS_ENCRYPTION_PASSWORD``. |
729 | ||
16a18dad | 730 | Using a master key to store and recover encryption keys |
c23e257c | 731 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
16a18dad DW |
732 | |
733 | You can also use ``proxmox-backup-client key`` to create an RSA public/private | |
734 | key pair, which can be used to store an encrypted version of the symmetric | |
735 | backup encryption key alongside each backup and recover it later. | |
736 | ||
737 | To set up a master key: | |
738 | ||
739 | 1. Create an encryption key for the backup: | |
740 | ||
741 | .. code-block:: console | |
742 | ||
743 | # proxmox-backup-client key create | |
744 | creating default key at: "~/.config/proxmox-backup/encryption-key.json" | |
745 | Encryption Key Password: ********** | |
746 | ... | |
747 | ||
748 | The resulting file will be saved to ``~/.config/proxmox-backup/encryption-key.json``. | |
749 | ||
750 | 2. Create an RSA public/private key pair: | |
751 | ||
752 | .. code-block:: console | |
753 | ||
754 | # proxmox-backup-client key create-master-key | |
755 | Master Key Password: ********* | |
756 | ... | |
757 | ||
758 | This will create two files in your current directory, ``master-public.pem`` | |
759 | and ``master-private.pem``. | |
760 | ||
761 | 3. Import the newly created ``master-public.pem`` public certificate, so that | |
762 | ``proxmox-backup-client`` can find and use it upon backup. | |
763 | ||
764 | .. code-block:: console | |
765 | ||
766 | # proxmox-backup-client key import-master-pubkey /path/to/master-public.pem | |
767 | Imported public master key to "~/.config/proxmox-backup/master-public.pem" | |
768 | ||
769 | 4. With all these files in place, run a backup job: | |
770 | ||
771 | .. code-block:: console | |
772 | ||
773 | # proxmox-backup-client backup etc.pxar:/etc | |
774 | ||
775 | The key will be stored in your backup, under the name ``rsa-encrypted.key``. | |
776 | ||
777 | .. Note:: The ``--keyfile`` parameter can be excluded, if the encryption key | |
778 | is in the default path. If you specified another path upon creation, you | |
779 | must pass the ``--keyfile`` parameter. | |
780 | ||
781 | 5. To test that everything worked, you can restore the key from the backup: | |
782 | ||
783 | .. code-block:: console | |
784 | ||
785 | # proxmox-backup-client restore /path/to/backup/ rsa-encrypted.key /path/to/target | |
786 | ||
787 | .. Note:: You should not need an encryption key to extract this file. However, if | |
788 | a key exists at the default location | |
789 | (``~/.config/proxmox-backup/encryption-key.json``) the program will prompt | |
790 | you for an encryption key password. Simply moving ``encryption-key.json`` | |
791 | out of this directory will fix this issue. | |
792 | ||
793 | 6. Then, use the previously generated master key to decrypt the file: | |
794 | ||
795 | .. code-block:: console | |
796 | ||
797 | # openssl rsautl -decrypt -inkey master-private.pem -in rsa-encrypted.key -out /path/to/target | |
798 | Enter pass phrase for ./master-private.pem: ********* | |
799 | ||
800 | 7. The target file will now contain the encryption key information in plain | |
801 | text. The success of this can be confirmed by passing the resulting ``json`` | |
802 | file, with the ``--keyfile`` parameter, when decrypting files from the backup. | |
5a499f32 | 803 | |
16a18dad DW |
804 | .. warning:: Without their key, backed up files will be inaccessible. Thus, you should |
805 | keep keys ordered and in a place that is separate from the contents being | |
806 | backed up. It can happen, for example, that you back up an entire system, using | |
807 | a key on that system. If the system then becomes inaccessable for any reason | |
808 | and needs to be restored, this will not be possible as the encryption key will be | |
74fc8447 DW |
809 | lost along with the broken system. In preparation for the worst case scenario, |
810 | you should consider keeping a paper copy of this key locked away in | |
811 | a safe place. | |
58ea88c8 DM |
812 | |
813 | Restoring Data | |
814 | ~~~~~~~~~~~~~~ | |
815 | ||
aef49768 DW |
816 | The regular creation of backups is a necessary step to avoiding data |
817 | loss. More importantly, however, is the restoration. It is good practice to perform | |
4f3db187 | 818 | periodic recovery tests to ensure that you can access the data in |
64b85116 DM |
819 | case of problems. |
820 | ||
4f3db187 | 821 | First, you need to find the snapshot which you want to restore. The snapshot |
aef49768 | 822 | command provides a list of all the snapshots on the server: |
64b85116 DM |
823 | |
824 | .. code-block:: console | |
825 | ||
826 | # proxmox-backup-client snapshots | |
96feecd6 DM |
827 | ┌────────────────────────────────┬─────────────┬────────────────────────────────────┐ |
828 | │ snapshot │ size │ files │ | |
829 | ╞════════════════════════════════╪═════════════╪════════════════════════════════════╡ | |
830 | │ host/elsa/2019-12-03T09:30:15Z │ 51788646825 │ root.pxar catalog.pcat1 index.json │ | |
831 | ├────────────────────────────────┼─────────────┼────────────────────────────────────┤ | |
832 | │ host/elsa/2019-12-03T09:35:01Z │ 51790622048 │ root.pxar catalog.pcat1 index.json │ | |
833 | ├────────────────────────────────┼─────────────┼────────────────────────────────────┤ | |
64b85116 DM |
834 | ... |
835 | ||
4f3db187 | 836 | You can inspect the catalog to find specific files. |
64b85116 DM |
837 | |
838 | .. code-block:: console | |
839 | ||
3c50a9d8 | 840 | # proxmox-backup-client catalog dump host/elsa/2019-12-03T09:35:01Z |
64b85116 DM |
841 | ... |
842 | d "./root.pxar.didx/etc/cifs-utils" | |
843 | l "./root.pxar.didx/etc/cifs-utils/idmap-plugin" | |
844 | d "./root.pxar.didx/etc/console-setup" | |
845 | ... | |
846 | ||
847 | The restore command lets you restore a single archive from the | |
848 | backup. | |
849 | ||
850 | .. code-block:: console | |
851 | ||
852 | # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z root.pxar /target/path/ | |
853 | ||
4cda7603 | 854 | To get the contents of any archive, you can restore the ``index.json`` file in the |
aef49768 | 855 | repository to the target path '-'. This will dump the contents to the standard output. |
64b85116 DM |
856 | |
857 | .. code-block:: console | |
858 | ||
859 | # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z index.json - | |
860 | ||
861 | ||
862 | Interactive Restores | |
863 | ^^^^^^^^^^^^^^^^^^^^ | |
864 | ||
865 | If you only want to restore a few individual files, it is often easier | |
866 | to use the interactive recovery shell. | |
867 | ||
868 | .. code-block:: console | |
869 | ||
3c50a9d8 | 870 | # proxmox-backup-client catalog shell host/elsa/2019-12-03T09:35:01Z root.pxar |
64b85116 DM |
871 | Starting interactive shell |
872 | pxar:/ > ls | |
873 | bin boot dev etc home lib lib32 | |
874 | ... | |
875 | ||
3f0983b7 | 876 | The interactive recovery shell is a minimalistic command line interface that |
4f3db187 AL |
877 | utilizes the metadata stored in the catalog to quickly list, navigate and |
878 | search files in a file archive. | |
879 | To restore files, you can select them individually or match them with a glob | |
880 | pattern. | |
881 | ||
882 | Using the catalog for navigation reduces the overhead considerably because only | |
883 | the catalog needs to be downloaded and, optionally, decrypted. | |
3f0983b7 CE |
884 | The actual chunks are only accessed if the metadata in the catalog is not enough |
885 | or for the actual restore. | |
886 | ||
887 | Similar to common UNIX shells ``cd`` and ``ls`` are the commands used to change | |
4f3db187 | 888 | working directory and list directory contents in the archive. |
3f0983b7 CE |
889 | ``pwd`` shows the full path of the current working directory with respect to the |
890 | archive root. | |
891 | ||
aef49768 | 892 | Being able to quickly search the contents of the archive is a commmonly needed feature. |
3f0983b7 CE |
893 | That's where the catalog is most valuable. |
894 | For example: | |
895 | ||
896 | .. code-block:: console | |
897 | ||
a83674ad | 898 | pxar:/ > find etc/**/*.txt --select |
3f0983b7 CE |
899 | "/etc/X11/rgb.txt" |
900 | pxar:/ > list-selected | |
901 | etc/**/*.txt | |
902 | pxar:/ > restore-selected /target/path | |
903 | ... | |
904 | ||
905 | This will find and print all files ending in ``.txt`` located in ``etc/`` or a | |
906 | subdirectory and add the corresponding pattern to the list for subsequent restores. | |
907 | ``list-selected`` shows these patterns and ``restore-selected`` finally restores | |
908 | all files in the archive matching the patterns to ``/target/path`` on the local | |
909 | host. This will scan the whole archive. | |
910 | ||
911 | With ``restore /target/path`` you can restore the sub-archive given by the current | |
912 | working directory to the local target path ``/target/path`` on your host. | |
913 | By additionally passing a glob pattern with ``--pattern <glob>``, the restore is | |
914 | further limited to files matching the pattern. | |
915 | For example: | |
916 | ||
917 | .. code-block:: console | |
918 | ||
919 | pxar:/ > cd /etc/ | |
920 | pxar:/etc/ > restore /target/ --pattern **/*.conf | |
921 | ... | |
922 | ||
923 | The above will scan trough all the directories below ``/etc`` and restore all | |
924 | files ending in ``.conf``. | |
925 | ||
926 | .. todo:: Explain interactive restore in more detail | |
64b85116 | 927 | |
c7971d7f CE |
928 | Mounting of Archives via FUSE |
929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
930 | ||
931 | The :term:`FUSE` implementation for the pxar archive allows you to mount a | |
932 | file archive as a read-only filesystem to a mountpoint on your host. | |
933 | ||
934 | .. code-block:: console | |
935 | ||
74fc8447 DW |
936 | # proxmox-backup-client mount host/backup-client/2020-01-29T11:29:22Z root.pxar /mnt/mountpoint |
937 | # ls /mnt/mountpoint | |
c7971d7f CE |
938 | bin dev home lib32 libx32 media opt root sbin sys usr |
939 | boot etc lib lib64 lost+found mnt proc run srv tmp var | |
940 | ||
aef49768 | 941 | This allows you to access the full contents of the archive in a seamless manner. |
c7971d7f CE |
942 | |
943 | .. note:: As the FUSE connection needs to fetch and decrypt chunks from the | |
aef49768 | 944 | backup server's datastore, this can cause some additional network and CPU |
c7971d7f CE |
945 | load on your host, depending on the operations you perform on the mounted |
946 | filesystem. | |
947 | ||
4f3db187 | 948 | To unmount the filesystem use the ``umount`` command on the mountpoint: |
c7971d7f CE |
949 | |
950 | .. code-block:: console | |
951 | ||
74fc8447 | 952 | # umount /mnt/mountpoint |
58ea88c8 | 953 | |
ac456d85 DM |
954 | Login and Logout |
955 | ~~~~~~~~~~~~~~~~ | |
956 | ||
957 | The client tool prompts you to enter the logon password as soon as you | |
958 | want to access the backup server. The server checks your credentials | |
959 | and responds with a ticket that is valid for two hours. The client | |
4f3db187 | 960 | tool automatically stores that ticket and uses it for further requests |
ac456d85 DM |
961 | to this server. |
962 | ||
963 | You can also manually trigger this login/logout using the login and | |
964 | logout commands: | |
965 | ||
966 | .. code-block:: console | |
967 | ||
968 | # proxmox-backup-client login | |
969 | Password: ********** | |
970 | ||
4f3db187 | 971 | To remove the ticket, issue a logout: |
ac456d85 DM |
972 | |
973 | .. code-block:: console | |
974 | ||
975 | # proxmox-backup-client logout | |
976 | ||
977 | ||
22231524 SI |
978 | .. _pruning: |
979 | ||
6e5a0c03 DM |
980 | Pruning and Removing Backups |
981 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
982 | ||
983 | You can manually delete a backup snapshot using the ``forget`` | |
984 | command: | |
985 | ||
986 | .. code-block:: console | |
987 | ||
988 | # proxmox-backup-client forget <snapshot> | |
989 | ||
990 | ||
4f3db187 AL |
991 | .. caution:: This command removes all archives in this backup |
992 | snapshot. They will be inaccessible and unrecoverable. | |
6e5a0c03 DM |
993 | |
994 | ||
4cda7603 DW |
995 | Although manual removal is sometimes required, the ``prune`` |
996 | command is normally used to systematically delete older backups. Prune lets | |
4f3db187 AL |
997 | you specify which backup snapshots you want to keep. The |
998 | following retention options are available: | |
52b2be97 DM |
999 | |
1000 | ``--keep-last <N>`` | |
1001 | Keep the last ``<N>`` backup snapshots. | |
1002 | ||
102d8d41 | 1003 | ``--keep-hourly <N>`` |
4f3db187 AL |
1004 | Keep backups for the last ``<N>`` hours. If there is more than one |
1005 | backup for a single hour, only the latest is kept. | |
102d8d41 | 1006 | |
52b2be97 | 1007 | ``--keep-daily <N>`` |
4f3db187 AL |
1008 | Keep backups for the last ``<N>`` days. If there is more than one |
1009 | backup for a single day, only the latest is kept. | |
52b2be97 DM |
1010 | |
1011 | ``--keep-weekly <N>`` | |
4f3db187 AL |
1012 | Keep backups for the last ``<N>`` weeks. If there is more than one |
1013 | backup for a single week, only the latest is kept. | |
52b2be97 | 1014 | |
4f3db187 AL |
1015 | .. note:: Weeks start on Monday and end on Sunday. The software |
1016 | uses the `ISO week date`_ system and handles weeks at | |
1017 | the end of the year correctly. | |
1af66370 | 1018 | |
52b2be97 | 1019 | ``--keep-monthly <N>`` |
4f3db187 AL |
1020 | Keep backups for the last ``<N>`` months. If there is more than one |
1021 | backup for a single month, only the latest is kept. | |
52b2be97 DM |
1022 | |
1023 | ``--keep-yearly <N>`` | |
4f3db187 AL |
1024 | Keep backups for the last ``<N>`` years. If there is more than one |
1025 | backup for a single year, only the latest is kept. | |
1026 | ||
1027 | The retention options are processed in the order given above. Each option | |
1028 | only covers backups within its time period. The next option does not take care | |
1029 | of already covered backups. It will only consider older backups. | |
52b2be97 | 1030 | |
4f3db187 AL |
1031 | Unfinished and incomplete backups will be removed by the prune command unless |
1032 | they are newer than the last successful backup. In this case, the last failed | |
1033 | backup is retained. | |
02d22dec | 1034 | |
6e5a0c03 DM |
1035 | .. code-block:: console |
1036 | ||
1037 | # proxmox-backup-client prune <group> --keep-daily 7 --keep-weekly 4 --keep-monthly 3 | |
1038 | ||
1039 | ||
4f3db187 | 1040 | You can use the ``--dry-run`` option to test your settings. This only |
aef49768 | 1041 | shows the list of existing snapshots and what actions prune would take. |
84322d8c DM |
1042 | |
1043 | .. code-block:: console | |
1044 | ||
1045 | # proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3 | |
a66d5898 DM |
1046 | ┌────────────────────────────────┬──────┐ |
1047 | │ snapshot │ keep │ | |
1048 | ╞════════════════════════════════╪══════╡ | |
1049 | │ host/elsa/2019-12-04T13:20:37Z │ 1 │ | |
1050 | ├────────────────────────────────┼──────┤ | |
1051 | │ host/elsa/2019-12-03T09:35:01Z │ 0 │ | |
1052 | ├────────────────────────────────┼──────┤ | |
1053 | │ host/elsa/2019-11-22T11:54:47Z │ 1 │ | |
1054 | ├────────────────────────────────┼──────┤ | |
1055 | │ host/elsa/2019-11-21T12:36:25Z │ 0 │ | |
1056 | ├────────────────────────────────┼──────┤ | |
1057 | │ host/elsa/2019-11-10T10:42:20Z │ 1 │ | |
1058 | └────────────────────────────────┴──────┘ | |
84322d8c | 1059 | |
52b2be97 | 1060 | .. note:: Neither the ``prune`` command nor the ``forget`` command free space |
4f3db187 AL |
1061 | in the chunk-store. The chunk-store still contains the data blocks. To free |
1062 | space you need to perform :ref:`garbage-collection`. | |
6e5a0c03 DM |
1063 | |
1064 | ||
1065 | .. _garbage-collection: | |
1066 | ||
1067 | Garbage Collection | |
1068 | ~~~~~~~~~~~~~~~~~~ | |
1069 | ||
e1c356ec DM |
1070 | The ``prune`` command removes only the backup index files, not the data |
1071 | from the data store. This task is left to the garbage collection | |
4f3db187 | 1072 | command. It is recommended to carry out garbage collection on a regular basis. |
e1c356ec DM |
1073 | |
1074 | The garbage collection works in two phases. In the first phase, all | |
1075 | data blocks that are still in use are marked. In the second phase, | |
1076 | unused data blocks are removed. | |
1077 | ||
1078 | .. note:: This command needs to read all existing backup index files | |
f0188322 CE |
1079 | and touches the complete chunk-store. This can take a long time |
1080 | depending on the number of chunks and the speed of the underlying | |
e1c356ec DM |
1081 | disks. |
1082 | ||
8314ca9c AL |
1083 | .. note:: The garbage collection will only remove chunks that haven't been used |
1084 | for at least one day (exactly 24h 5m). This grace period is necessary because | |
1085 | chunks in use are marked by touching the chunk which updates the ``atime`` | |
1086 | (access time) property. Filesystems are mounted with the ``relatime`` option | |
1087 | by default. This results in a better performance by only updating the | |
1088 | ``atime`` property if the last access has been at least 24 hours ago. The | |
255ed621 TL |
1089 | downside is, that touching a chunk within these 24 hours will not always |
1090 | update its ``atime`` property. | |
8314ca9c | 1091 | |
255ed621 TL |
1092 | Chunks in the grace period will be logged at the end of the garbage |
1093 | collection task as *Pending removals*. | |
e1c356ec DM |
1094 | |
1095 | .. code-block:: console | |
1096 | ||
1097 | # proxmox-backup-client garbage-collect | |
1098 | starting garbage collection on store store2 | |
1099 | Start GC phase1 (mark used chunks) | |
1100 | Start GC phase2 (sweep unused chunks) | |
1101 | percentage done: 1, chunk count: 219 | |
1102 | percentage done: 2, chunk count: 453 | |
1103 | ... | |
1104 | percentage done: 99, chunk count: 21188 | |
1105 | Removed bytes: 411368505 | |
1106 | Removed chunks: 203 | |
1107 | Original data bytes: 327160886391 | |
1108 | Disk bytes: 52767414743 (16 %) | |
1109 | Disk chunks: 21221 | |
1110 | Average chunk size: 2486565 | |
1111 | TASK OK | |
1112 | ||
1113 | ||
1114 | .. todo:: howto run garbage-collection at regular intervalls (cron) | |
6e5a0c03 | 1115 | |
a8d69fcf DW |
1116 | Benchmarking |
1117 | ~~~~~~~~~~~~ | |
1118 | The backup client also comes with a benchmarking tool. This tool measures | |
1119 | various metrics relating to compression and encryption speeds. You can run a | |
1120 | benchmark using the ``benchmark`` subcommand of ``proxmox-backup-client``: | |
1121 | ||
1122 | .. code-block:: console | |
1123 | ||
1124 | # proxmox-backup-client benchmark | |
1125 | Uploaded 656 chunks in 5 seconds. | |
1126 | Time per request: 7659 microseconds. | |
1127 | TLS speed: 547.60 MB/s | |
1128 | SHA256 speed: 585.76 MB/s | |
1129 | Compression speed: 1923.96 MB/s | |
1130 | Decompress speed: 7885.24 MB/s | |
1131 | AES256/GCM speed: 3974.03 MB/s | |
1132 | ┌───────────────────────────────────┬─────────────────────┐ | |
1133 | │ Name │ Value │ | |
1134 | ╞═══════════════════════════════════╪═════════════════════╡ | |
1135 | │ TLS (maximal backup upload speed) │ 547.60 MB/s (93%) │ | |
1136 | ├───────────────────────────────────┼─────────────────────┤ | |
1137 | │ SHA256 checksum computation speed │ 585.76 MB/s (28%) │ | |
1138 | ├───────────────────────────────────┼─────────────────────┤ | |
1139 | │ ZStd level 1 compression speed │ 1923.96 MB/s (89%) │ | |
1140 | ├───────────────────────────────────┼─────────────────────┤ | |
1141 | │ ZStd level 1 decompression speed │ 7885.24 MB/s (98%) │ | |
1142 | ├───────────────────────────────────┼─────────────────────┤ | |
1143 | │ AES256 GCM encryption speed │ 3974.03 MB/s (104%) │ | |
1144 | └───────────────────────────────────┴─────────────────────┘ | |
1145 | ||
1146 | You can also pass the ``--output-format`` parameter to output stats in ``json``, | |
1147 | rather than the default table format. | |
6e5a0c03 | 1148 | |
a129fdd9 DM |
1149 | .. _pve-integration: |
1150 | ||
58ea88c8 DM |
1151 | `Proxmox VE`_ integration |
1152 | ------------------------- | |
cb01363c | 1153 | |
f9dcfa41 DM |
1154 | You need to define a new storage with type 'pbs' on your `Proxmox VE`_ |
1155 | node. The following example uses ``store2`` as storage name, and | |
1156 | assumes the server address is ``localhost``, and you want to connect | |
1157 | as ``user1@pbs``. | |
1158 | ||
1159 | .. code-block:: console | |
1160 | ||
1161 | # pvesm add pbs store2 --server localhost --datastore store2 | |
1162 | # pvesm set store2 --username user1@pbs --password <secret> | |
1163 | ||
1164 | If your backup server uses a self signed certificate, you need to add | |
1165 | the certificate fingerprint to the configuration. You can get the | |
1166 | fingerprint by running the following command on the backup server: | |
1167 | ||
1168 | .. code-block:: console | |
1169 | ||
1170 | # proxmox-backup-manager cert info |grep Fingerprint | |
1171 | Fingerprint (sha256): 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe | |
1172 | ||
1173 | Please add that fingerprint to your configuration to establish a trust | |
1174 | relationship: | |
1175 | ||
1176 | .. code-block:: console | |
1177 | ||
1178 | # pvesm set store2 --fingerprint 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe | |
1179 | ||
1180 | After that you should be able to see storage status with: | |
1181 | ||
1182 | .. code-block:: console | |
1183 | ||
1184 | # pvesm status --storage store2 | |
1185 | Name Type Status Total Used Available % | |
1186 | store2 pbs active 3905109820 1336687816 2568422004 34.23% | |
1187 | ||
1188 | ||
cb01363c DM |
1189 | |
1190 | .. include:: command-line-tools.rst | |
1191 | ||
1192 | .. include:: services.rst |