]> git.proxmox.com Git - proxmox-backup.git/blob - docs/administration-guide.rst
improve administration guide
[proxmox-backup.git] / docs / administration-guide.rst
1 Administration Guide
2 ====================
3
4 The administration guide.
5
6 .. todo:: either add a bit more explanation or remove the previous sentence
7
8 Terminology
9 -----------
10
11 Backup Content
12 ~~~~~~~~~~~~~~
13
14 When doing deduplication, there are different strategies to get
15 optimal results in terms of performance and/or deduplication rates.
16 Depending on the type of data, it can be split into *fixed* or *variable*
17 sized chunks.
18
19 Fixed sized chunking requires minimal CPU power, and is used to
20 backup virtual machine images.
21
22 Variable sized chunking needs more CPU power, but is essential to get
23 good deduplication rates for file archives.
24
25 The Proxmox Backup Server supports both strategies.
26
27
28 File Archives: ``<name>.pxar``
29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30
31 .. see https://moinakg.wordpress.com/2013/06/22/high-performance-content-defined-chunking/
32
33 A file archive stores a full directory tree. Content is stored using
34 the :ref:`pxar-format`, split into variable-sized chunks. The format
35 is optimized to achieve good deduplication rates.
36
37
38 Image Archives: ``<name>.img``
39 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40
41 This is used for virtual machine images and other large binary
42 data. Content is split into fixed-sized chunks.
43
44
45 Binary Data (BLOBs)
46 ^^^^^^^^^^^^^^^^^^^
47
48 This type is used to store smaller (< 16MB) binary data such as
49 configuration files. Larger files should be stored as image archive.
50
51 .. caution:: Please do not store all files as BLOBs. Instead, use the
52 file archive to store whole directory trees.
53
54
55 Catalog File: ``catalog.pcat1``
56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57
58 The catalog file is an index for file archives. It contains
59 the list of files and is used to speed up search operations.
60
61
62 The Manifest: ``index.json``
63 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64
65 The manifest contains the list of all backup files, their
66 sizes and checksums. It is used to verify the consistency of a
67 backup.
68
69
70 Backup Type
71 ~~~~~~~~~~~
72
73 The backup server groups backups by *type*, where *type* is one of:
74
75 ``vm``
76 This type is used for :term:`virtual machine`\ s. Typically
77 consists of the virtual machine's configuration file and an image archive
78 for each disk.
79
80 ``ct``
81 This type is used for :term:`container`\ s. Consists of the container's
82 configuration and a single file archive for the filesystem content.
83
84 ``host``
85 This type is used for backups created from within the backed up machine.
86 Typically this would be a physical host but could also be a virtual machine
87 or container. Such backups may contain file and image archives, there are no restrictions in this regard.
88
89
90 Backup ID
91 ~~~~~~~~~
92
93 A unique ID. Usually the virtual machine or container ID. ``host``
94 type backups normally use the hostname.
95
96
97 Backup Time
98 ~~~~~~~~~~~
99
100 The time when the backup was made.
101
102
103 Backup Group
104 ~~~~~~~~~~~~
105
106 The tuple ``<type>/<ID>`` is called a backup group. Such a group
107 may contain one or more backup snapshots.
108
109
110 Backup Snapshot
111 ~~~~~~~~~~~~~~~
112
113 The triplet ``<type>/<ID>/<time>`` is called a backup snapshot. It
114 uniquely identifies a specific backup within a datastore.
115
116 .. code-block:: console
117 :caption: Backup Snapshot Examples
118
119 vm/104/2019-10-09T08:01:06Z
120 host/elsa/2019-11-08T09:48:14Z
121
122 As you can see, the time format is RFC3399_ with Coordinated
123 Universal Time (UTC_, identified by the trailing *Z*).
124
125 Backup Server Management
126 ------------------------
127
128 The command line tool to configure and manage the backup server is called
129 :command:`proxmox-backup-manager`.
130
131
132
133 :term:`DataStore`
134 ~~~~~~~~~~~~~~~~~
135
136 A datastore is a place where backups are stored. The current implementation
137 uses a directory inside a standard unix file system (``ext4``, ``xfs``
138 or ``zfs``) to store the backup data.
139
140 Datastores are identified by a simple *ID*. You can configure it
141 when setting up the backup server.
142
143
144
145 Datastore Configuration
146 ~~~~~~~~~~~~~~~~~~~~~~~
147
148 You can configure multiple datastores. Minimum one datastore needs to be
149 configured. The datastore is identified by a simple `name` and points to a
150 directory on the filesystem.
151
152 The following command creates a new datastore called ``store1`` on :file:`/backup/disk1/store1`
153
154 .. code-block:: console
155
156 # proxmox-backup-manager datastore create store1 /backup/disk1/store1
157
158 To list existing datastores run:
159
160 .. code-block:: console
161
162 # proxmox-backup-manager datastore list
163 ┌────────┬──────────────────────┬─────────────────────────────┐
164 │ name │ path │ comment │
165 ╞════════╪══════════════════════╪═════════════════════════════╡
166 │ store1 │ /backup/disk1/store1 │ This is my default storage. │
167 └────────┴──────────────────────┴─────────────────────────────┘
168
169 Finally, it is possible to remove the datastore configuration:
170
171 .. code-block:: console
172
173 # proxmox-backup-manager datastore remove store1
174
175 .. note:: The above command removes only the datastore configuration. It does
176 not delete any data from the underlying directory.
177
178
179 File Layout
180 ^^^^^^^^^^^
181
182 After creating a datastore, the following default layout will appear:
183
184 .. code-block:: console
185 # ls -arilh /backup/disk1/store1
186 276493 -rw-r--r-- 1 backup backup 0 Jul 8 12:35 .lock
187 276490 drwxr-x--- 1 backup backup 1064960 Jul 8 12:35 .chunks
188
189 `.lock` is an empty file used for process locking.
190
191 The `.chunks` directory contains folders, starting from `0000` and taking hexadecimal values until `ffff`. These
192 directories will store the chunked data after a backup operation has been executed.
193
194 .. code-block:: console
195 # ls -arilh /backup/disk1/store1/.chunks
196 545824 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 ffff
197 545823 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffe
198 415621 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffd
199 415620 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffc
200 353187 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffb
201 344995 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffa
202 144079 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff9
203 144078 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff8
204 144077 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff7
205 ...
206 403180 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000c
207 403179 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000b
208 403177 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000a
209 402530 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0009
210 402513 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0008
211 402509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0007
212 276509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0006
213 276508 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0005
214 276507 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0004
215 276501 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0003
216 276499 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0002
217 276498 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0001
218 276494 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0000
219 276489 drwxr-xr-x 3 backup backup 4.0K Jul 8 12:35 ..
220 276490 drwxr-x--- 1 backup backup 1.1M Jul 8 12:35 .
221
222
223
224 User Management
225 ~~~~~~~~~~~~~~~
226
227 Proxmox Backup Server supports several authentication realms, and you need to
228 choose the realm when you add a new user. Possible realms are:
229
230 :pam: Linux PAM standard authentication. Use this if you want to
231 authenticate as Linux system user (Users need to exist on the
232 system).
233
234 :pbs: Proxmox Backup Server realm. This type stores hashed passwords in
235 ``/etc/proxmox-backup/shadow.json``.
236
237 After installation, there is a single user ``root@pam``, which
238 corresponds to the Unix superuser. You can use the
239 ``proxmox-backup-manager`` command line tool to list or manipulate
240 users:
241
242 .. code-block:: console
243
244 # proxmox-backup-manager user list
245 ┌─────────────┬────────┬────────┬───────────┬──────────┬────────────────┬────────────────────┐
246 │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │
247 ╞═════════════╪════════╪════════╪═══════════╪══════════╪════════════════╪════════════════════╡
248 │ root@pam │ 1 │ │ │ │ │ Superuser │
249 └─────────────┴────────┴────────┴───────────┴──────────┴────────────────┴────────────────────┘
250
251 The superuser has full administration rights on everything, so you
252 normally want to add other users with less privileges:
253
254 .. code-block:: console
255
256 # proxmox-backup-manager user create john@pbs --email john@example.com
257
258 The create command lets you specify many options like ``--email`` or
259 ``--password``. You can update or change any of them using the
260 update command later:
261
262 .. code-block:: console
263
264 # proxmox-backup-manager user update john@pbs --firstname John --lastname Smith
265 # proxmox-backup-manager user update john@pbs --comment "An example user."
266
267 .. todo:: Mention how to set password without passing plaintext password as cli argument.
268
269
270 The resulting user list looks like this:
271
272 .. code-block:: console
273
274 # proxmox-backup-manager user list
275 ┌──────────┬────────┬────────┬───────────┬──────────┬──────────────────┬──────────────────┐
276 │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │
277 ╞══════════╪════════╪════════╪═══════════╪══════════╪══════════════════╪══════════════════╡
278 │ john@pbs │ 1 │ │ John │ Smith │ john@example.com │ An example user. │
279 ├──────────┼────────┼────────┼───────────┼──────────┼──────────────────┼──────────────────┤
280 │ root@pam │ 1 │ │ │ │ │ Superuser │
281 └──────────┴────────┴────────┴───────────┴──────────┴──────────────────┴──────────────────┘
282
283 Newly created users do not have any permissions. Please read the next
284 section to learn how to set access permissions.
285
286 If you want to disable a user account, you can do that by setting ``--enable`` to ``0``
287
288 .. code-block:: console
289
290 # proxmox-backup-manager user update john@pbs --enable 0
291
292 Or completely remove the user with:
293
294 .. code-block:: console
295
296 # proxmox-backup-manager user remove john@pbs
297
298
299 Access Control
300 ~~~~~~~~~~~~~~
301
302 By default new users do not have any permission. Instead you need to
303 specify what is allowed and what is not. You can do this by assigning
304 roles to users on specific objects like datastores or remotes. The
305 following roles exist:
306
307 **NoAccess**
308 Disable Access - nothing is allowed.
309
310 **Admin**
311 The Administrator can do anything.
312
313 **Audit**
314 An Auditor can view things, but is not allowed to change settings.
315
316 **DatastoreAdmin**
317 Can do anything on datastores.
318
319 **DatastoreAudit**
320 Can view datastore settings and list content. But
321 is not allowed to read the actual data.
322
323 **DataStoreReader**
324 Can Inspect datastore content and can do restores.
325
326 **DataStoreBackup**
327 Can backup and restore owned backups.
328
329 **DatastorePowerUser**
330 Can backup, restore, and prune owned backups.
331
332 **RemoteAdmin**
333 Can do anything on remotes.
334
335 **RemoteAudit**
336 Can view remote settings.
337
338 **RemoteSyncOperator**
339 Is allowed to read data from a remote.
340
341
342 Backup Client usage
343 -------------------
344
345 The command line client is called :command:`proxmox-backup-client`.
346
347
348 Respository Locations
349 ~~~~~~~~~~~~~~~~~~~~~
350
351 The client uses the following notation to specify a datastore repository
352 on the backup server.
353
354 [[username@]server:]datastore
355
356 The default value for ``username`` ist ``root``. If no server is specified,
357 the default is the local host (``localhost``).
358
359 You can pass the repository with the ``--repository`` command
360 line option, or by setting the ``PBS_REPOSITORY`` environment
361 variable.
362
363
364 Environment Variables
365 ~~~~~~~~~~~~~~~~~~~~~
366
367 ``PBS_REPOSITORY``
368 The default backup repository.
369
370 ``PBS_PASSWORD``
371 When set, this value is used for the password required for the
372 backup server.
373
374 ``PBS_ENCRYPTION_PASSWORD``
375 When set, this value is used to access the secret encryption key (if
376 protected by password).
377
378 ``PBS_FINGERPRINT`` When set, this value is used to verify the server
379 certificate (only used if the system CA certificates cannot
380 validate the certificate).
381
382
383 Output Format
384 ~~~~~~~~~~~~~
385
386 Most commands support the ``--output-format`` parameter. It accepts
387 the following values:
388
389 :``text``: Text format (default). Structured data is rendered as a table.
390
391 :``json``: JSON (single line).
392
393 :``json-pretty``: JSON (multiple lines, nicely formatted).
394
395
396 Please use the following environment variables to modify output behavior:
397
398 ``PROXMOX_OUTPUT_FORMAT``
399 Defines the default output format.
400
401 ``PROXMOX_OUTPUT_NO_BORDER``
402 If set (to any value), do not render table borders.
403
404 ``PROXMOX_OUTPUT_NO_HEADER``
405 If set (to any value), do not render table headers.
406
407 .. note:: The ``text`` format is designed to be human readable, and
408 not meant to be parsed by automation tools. Please use the ``json``
409 format if you need to process the output.
410
411
412 .. _creating-backups:
413
414 Creating Backups
415 ~~~~~~~~~~~~~~~~
416
417 This section explains how to create a backup from within the machine. This can
418 be a physical host, a virtual machine, or a container. Such backups may contain file
419 and image archives. There are no restrictions in this case.
420
421 .. note:: If you want to backup virtual machines or containers on Proxmox VE, see :ref:`pve-integration`.
422
423 For the following example you need to have a backup server set up, working
424 credentials and need to know the repository name.
425 In the following examples we use ``backup-server:store1``.
426
427 .. code-block:: console
428
429 # proxmox-backup-client backup root.pxar:/ --repository backup-server:store1
430 Starting backup: host/elsa/2019-12-03T09:35:01Z
431 Client name: elsa
432 skip mount point: "/boot/efi"
433 skip mount point: "/dev"
434 skip mount point: "/run"
435 skip mount point: "/sys"
436 Uploaded 12129 chunks in 87 seconds (564 MB/s).
437 End Time: 2019-12-03T10:36:29+01:00
438
439 This will prompt you for a password and then uploads a file archive named
440 ``root.pxar`` containing all the files in the ``/`` directory.
441
442 .. Caution:: Please note that the proxmox-backup-client does not
443 automatically include mount points. Instead, you will see a short
444 ``skip mount point`` notice for each of them. The idea is to
445 create a separate file archive for each mounted disk. You can
446 explicitly include them using the ``--include-dev`` option
447 (i.e. ``--include-dev /boot/efi``). You can use this option
448 multiple times for each mount point that should be included.
449
450 The ``--repository`` option can get quite long and is used by all
451 commands. You can avoid having to enter this value by setting the
452 environment variable ``PBS_REPOSITORY``.
453
454 .. code-block:: console
455
456 # export PBS_REPOSTORY=backup-server:store1
457
458 After this you can execute all commands without specifying the ``--repository``
459 option.
460
461 One single backup is allowed to contain more than one archive. For example, if
462 you want to backup two disks mounted at ``/mmt/disk1`` and ``/mnt/disk2``:
463
464 .. code-block:: console
465
466 # proxmox-backup-client backup disk1.pxar:/mnt/disk1 disk2.pxar:/mnt/disk2
467
468 This creates a backup of both disks.
469
470 The backup command takes a list of backup specifications, which
471 include the archive name on the server, the type of the archive, and the
472 archive source at the client. The format is:
473
474 <archive-name>.<type>:<source-path>
475
476 Common types are ``.pxar`` for file archives, and ``.img`` for block
477 device images. To create a backup of a block device run the following command:
478
479 .. code-block:: console
480
481 # proxmox-backup-client backup mydata.img:/dev/mylvm/mydata
482
483 Excluding files/folders from a backup
484 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
485
486 Sometimes it is desired to exclude certain files or folders from a backup archive.
487 To tell the Proxmox backup client when and how to ignore files and directories,
488 place a text file called ``.pxarexclude`` in the filesystem hierarchy.
489 Whenever the backup client encounters such a file in a directory, it interprets
490 each line as glob match patterns for files and directories that are to be excluded
491 from the backup.
492
493 The file must contain a single glob pattern per line. Empty lines are ignored.
494 The same is true for lines starting with ``#``, which indicates a comment.
495 A ``!`` at the beginning of a line reverses the glob match pattern from an exclusion
496 to an explicit inclusion. This makes it possible to exclude all entries in a
497 directory except for a few single files/subdirectories.
498 Lines ending in ``/`` match only on directories.
499 The directory containing the ``.pxarexclude`` file is considered to be the root of
500 the given patterns. It is only possible to match files in this directory and its subdirectories.
501
502 ``\`` is used to escape special glob characters.
503 ``?`` matches any single character.
504 ``*`` matches any character, including an empty string.
505 ``**`` is used to match subdirectories. It can be used to, for example, exclude
506 all files ending in ``.tmp`` within the directory or subdirectories with the
507 following pattern ``**/*.tmp``.
508 ``[...]`` matches a single character from any of the provided characters within
509 the brackets. ``[!...]`` does the complementary and matches any singe character
510 not contained within the brackets. It is also possible to specify ranges with two
511 characters separated by ``-``. For example, ``[a-z]`` matches any lowercase
512 alphabetic character and ``[0-9]`` matches any one single digit.
513
514 The order of the glob match patterns defines if a file is included or
515 excluded, later entries win over previous ones.
516 This is also true for match patterns encountered deeper down the directory tree,
517 which can override a previous exclusion.
518 Be aware that excluded directories will **not** be read by the backup client.
519 A ``.pxarexclude`` file in a subdirectory will have no effect.
520 ``.pxarexclude`` files are treated as regular files and will be included in the
521 backup archive.
522
523 For example, consider the following directory structure:
524
525 .. code-block:: console
526
527 # ls -aR folder
528 folder/:
529 . .. .pxarexclude subfolder0 subfolder1
530
531 folder/subfolder0:
532 . .. file0 file1 file2 file3 .pxarexclude
533
534 folder/subfolder1:
535 . .. file0 file1 file2 file3
536
537 The different ``.pxarexclude`` files contain the following:
538
539 .. code-block:: console
540
541 # cat folder/.pxarexclude
542 /subfolder0/file1
543 /subfolder1/*
544 !/subfolder1/file2
545
546 .. code-block:: console
547
548 # cat folder/subfolder0/.pxarexclude
549 file3
550
551 This would exclude ``file1`` and ``file3`` in ``subfolder0`` and all of
552 ``subfolder1`` except ``file2``.
553
554 Restoring this backup will result in:
555
556 .. code-block:: console
557
558 ls -aR restored
559 restored/:
560 . .. .pxarexclude subfolder0 subfolder1
561
562 restored/subfolder0:
563 . .. file0 file2 .pxarexclude
564
565 restored/subfolder1:
566 . .. file2
567
568 Encryption
569 ^^^^^^^^^^
570
571 Proxmox backup supports client side encryption with AES-256 in GCM_
572 mode. First you need to create an encryption key:
573
574 .. code-block:: console
575
576 # proxmox-backup-client key create my-backup.key
577 Encryption Key Password: **************
578
579 The key is password protected by default. If you do not need this
580 extra protection, you can also create it without a password:
581
582 .. code-block:: console
583
584 # proxmox-backup-client key create /path/to/my-backup.key --kdf none
585
586
587 .. code-block:: console
588
589 # proxmox-backup-client backup etc.pxar:/etc --keyfile /path/to/my-backup.key
590 Password: *********
591 Encryption Key Password: **************
592 ...
593
594
595 You can avoid entering the passwords by setting the environment
596 variables ``PBS_PASSWORD`` and ``PBS_ENCRYPTION_PASSWORD``.
597
598 .. todo:: Explain master-key
599
600
601 Restoring Data
602 ~~~~~~~~~~~~~~
603
604 The regular creation of backups is a necessary step to avoid data
605 loss. More important, however, is the restoration. It is good practice to perform
606 periodic recovery tests to ensure that you can access the data in
607 case of problems.
608
609 First, you need to find the snapshot which you want to restore. The snapshot
610 command gives a list of all snapshots on the server:
611
612 .. code-block:: console
613
614 # proxmox-backup-client snapshots
615 ┌────────────────────────────────┬─────────────┬────────────────────────────────────┐
616 │ snapshot │ size │ files │
617 ╞════════════════════════════════╪═════════════╪════════════════════════════════════╡
618 │ host/elsa/2019-12-03T09:30:15Z │ 51788646825 │ root.pxar catalog.pcat1 index.json │
619 ├────────────────────────────────┼─────────────┼────────────────────────────────────┤
620 │ host/elsa/2019-12-03T09:35:01Z │ 51790622048 │ root.pxar catalog.pcat1 index.json │
621 ├────────────────────────────────┼─────────────┼────────────────────────────────────┤
622 ...
623
624 You can inspect the catalog to find specific files.
625
626 .. code-block:: console
627
628 # proxmox-backup-client catalog dump host/elsa/2019-12-03T09:35:01Z
629 ...
630 d "./root.pxar.didx/etc/cifs-utils"
631 l "./root.pxar.didx/etc/cifs-utils/idmap-plugin"
632 d "./root.pxar.didx/etc/console-setup"
633 ...
634
635 The restore command lets you restore a single archive from the
636 backup.
637
638 .. code-block:: console
639
640 # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z root.pxar /target/path/
641
642 To get the contents of any archive you can restore the ``ìndex.json`` file in the
643 repository and restore it to '-'. This will dump the content to the standard output.
644
645 .. code-block:: console
646
647 # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z index.json -
648
649
650 Interactive Restores
651 ^^^^^^^^^^^^^^^^^^^^
652
653 If you only want to restore a few individual files, it is often easier
654 to use the interactive recovery shell.
655
656 .. code-block:: console
657
658 # proxmox-backup-client catalog shell host/elsa/2019-12-03T09:35:01Z root.pxar
659 Starting interactive shell
660 pxar:/ > ls
661 bin boot dev etc home lib lib32
662 ...
663
664 The interactive recovery shell is a minimalistic command line interface that
665 utilizes the metadata stored in the catalog to quickly list, navigate and
666 search files in a file archive.
667 To restore files, you can select them individually or match them with a glob
668 pattern.
669
670 Using the catalog for navigation reduces the overhead considerably because only
671 the catalog needs to be downloaded and, optionally, decrypted.
672 The actual chunks are only accessed if the metadata in the catalog is not enough
673 or for the actual restore.
674
675 Similar to common UNIX shells ``cd`` and ``ls`` are the commands used to change
676 working directory and list directory contents in the archive.
677 ``pwd`` shows the full path of the current working directory with respect to the
678 archive root.
679
680 Being able to quickly search the contents of the archive is a often needed feature.
681 That's where the catalog is most valuable.
682 For example:
683
684 .. code-block:: console
685
686 pxar:/ > find etc/ **/*.txt --select
687 "/etc/X11/rgb.txt"
688 pxar:/ > list-selected
689 etc/**/*.txt
690 pxar:/ > restore-selected /target/path
691 ...
692
693 This will find and print all files ending in ``.txt`` located in ``etc/`` or a
694 subdirectory and add the corresponding pattern to the list for subsequent restores.
695 ``list-selected`` shows these patterns and ``restore-selected`` finally restores
696 all files in the archive matching the patterns to ``/target/path`` on the local
697 host. This will scan the whole archive.
698
699 With ``restore /target/path`` you can restore the sub-archive given by the current
700 working directory to the local target path ``/target/path`` on your host.
701 By additionally passing a glob pattern with ``--pattern <glob>``, the restore is
702 further limited to files matching the pattern.
703 For example:
704
705 .. code-block:: console
706
707 pxar:/ > cd /etc/
708 pxar:/etc/ > restore /target/ --pattern **/*.conf
709 ...
710
711 The above will scan trough all the directories below ``/etc`` and restore all
712 files ending in ``.conf``.
713
714 .. todo:: Explain interactive restore in more detail
715
716 Mounting of Archives via FUSE
717 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
718
719 The :term:`FUSE` implementation for the pxar archive allows you to mount a
720 file archive as a read-only filesystem to a mountpoint on your host.
721
722 .. code-block:: console
723
724 # proxmox-backup-client mount host/backup-client/2020-01-29T11:29:22Z root.pxar /mnt
725 # ls /mnt
726 bin dev home lib32 libx32 media opt root sbin sys usr
727 boot etc lib lib64 lost+found mnt proc run srv tmp var
728
729 This allows you to access the full content of the archive in a seamless manner.
730
731 .. note:: As the FUSE connection needs to fetch and decrypt chunks from the
732 backup servers datastore, this can cause some additional network and CPU
733 load on your host, depending on the operations you perform on the mounted
734 filesystem.
735
736 To unmount the filesystem use the ``umount`` command on the mountpoint:
737
738 .. code-block:: console
739
740 # umount /mnt
741
742 Login and Logout
743 ~~~~~~~~~~~~~~~~
744
745 The client tool prompts you to enter the logon password as soon as you
746 want to access the backup server. The server checks your credentials
747 and responds with a ticket that is valid for two hours. The client
748 tool automatically stores that ticket and uses it for further requests
749 to this server.
750
751 You can also manually trigger this login/logout using the login and
752 logout commands:
753
754 .. code-block:: console
755
756 # proxmox-backup-client login
757 Password: **********
758
759 To remove the ticket, issue a logout:
760
761 .. code-block:: console
762
763 # proxmox-backup-client logout
764
765
766 Pruning and Removing Backups
767 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
768
769 You can manually delete a backup snapshot using the ``forget``
770 command:
771
772 .. code-block:: console
773
774 # proxmox-backup-client forget <snapshot>
775
776
777 .. caution:: This command removes all archives in this backup
778 snapshot. They will be inaccessible and unrecoverable.
779
780
781 The manual removal is sometimes required, but normally the prune
782 command is used to systematically delete older backups. Prune lets
783 you specify which backup snapshots you want to keep. The
784 following retention options are available:
785
786 ``--keep-last <N>``
787 Keep the last ``<N>`` backup snapshots.
788
789 ``--keep-hourly <N>``
790 Keep backups for the last ``<N>`` hours. If there is more than one
791 backup for a single hour, only the latest is kept.
792
793 ``--keep-daily <N>``
794 Keep backups for the last ``<N>`` days. If there is more than one
795 backup for a single day, only the latest is kept.
796
797 ``--keep-weekly <N>``
798 Keep backups for the last ``<N>`` weeks. If there is more than one
799 backup for a single week, only the latest is kept.
800
801 .. note:: Weeks start on Monday and end on Sunday. The software
802 uses the `ISO week date`_ system and handles weeks at
803 the end of the year correctly.
804
805 ``--keep-monthly <N>``
806 Keep backups for the last ``<N>`` months. If there is more than one
807 backup for a single month, only the latest is kept.
808
809 ``--keep-yearly <N>``
810 Keep backups for the last ``<N>`` years. If there is more than one
811 backup for a single year, only the latest is kept.
812
813 The retention options are processed in the order given above. Each option
814 only covers backups within its time period. The next option does not take care
815 of already covered backups. It will only consider older backups.
816
817 Unfinished and incomplete backups will be removed by the prune command unless
818 they are newer than the last successful backup. In this case, the last failed
819 backup is retained.
820
821 .. code-block:: console
822
823 # proxmox-backup-client prune <group> --keep-daily 7 --keep-weekly 4 --keep-monthly 3
824
825
826 You can use the ``--dry-run`` option to test your settings. This only
827 shows the list of existing snapshots and which action prune would take.
828
829 .. code-block:: console
830
831 # proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3
832 ┌────────────────────────────────┬──────┐
833 │ snapshot │ keep │
834 ╞════════════════════════════════╪══════╡
835 │ host/elsa/2019-12-04T13:20:37Z │ 1 │
836 ├────────────────────────────────┼──────┤
837 │ host/elsa/2019-12-03T09:35:01Z │ 0 │
838 ├────────────────────────────────┼──────┤
839 │ host/elsa/2019-11-22T11:54:47Z │ 1 │
840 ├────────────────────────────────┼──────┤
841 │ host/elsa/2019-11-21T12:36:25Z │ 0 │
842 ├────────────────────────────────┼──────┤
843 │ host/elsa/2019-11-10T10:42:20Z │ 1 │
844 └────────────────────────────────┴──────┘
845
846 .. note:: Neither the ``prune`` command nor the ``forget`` command free space
847 in the chunk-store. The chunk-store still contains the data blocks. To free
848 space you need to perform :ref:`garbage-collection`.
849
850
851 .. _garbage-collection:
852
853 Garbage Collection
854 ~~~~~~~~~~~~~~~~~~
855
856 The ``prune`` command removes only the backup index files, not the data
857 from the data store. This task is left to the garbage collection
858 command. It is recommended to carry out garbage collection on a regular basis.
859
860 The garbage collection works in two phases. In the first phase, all
861 data blocks that are still in use are marked. In the second phase,
862 unused data blocks are removed.
863
864 .. note:: This command needs to read all existing backup index files
865 and touches the complete chunk-store. This can take a long time
866 depending on the number of chunks and the speed of the underlying
867 disks.
868
869
870 .. code-block:: console
871
872 # proxmox-backup-client garbage-collect
873 starting garbage collection on store store2
874 Start GC phase1 (mark used chunks)
875 Start GC phase2 (sweep unused chunks)
876 percentage done: 1, chunk count: 219
877 percentage done: 2, chunk count: 453
878 ...
879 percentage done: 99, chunk count: 21188
880 Removed bytes: 411368505
881 Removed chunks: 203
882 Original data bytes: 327160886391
883 Disk bytes: 52767414743 (16 %)
884 Disk chunks: 21221
885 Average chunk size: 2486565
886 TASK OK
887
888
889 .. todo:: howto run garbage-collection at regular intervalls (cron)
890
891
892 .. _pve-integration:
893
894 `Proxmox VE`_ integration
895 -------------------------
896
897 You need to define a new storage with type 'pbs' on your `Proxmox VE`_
898 node. The following example uses ``store2`` as storage name, and
899 assumes the server address is ``localhost``, and you want to connect
900 as ``user1@pbs``.
901
902 .. code-block:: console
903
904 # pvesm add pbs store2 --server localhost --datastore store2
905 # pvesm set store2 --username user1@pbs --password <secret>
906
907 If your backup server uses a self signed certificate, you need to add
908 the certificate fingerprint to the configuration. You can get the
909 fingerprint by running the following command on the backup server:
910
911 .. code-block:: console
912
913 # proxmox-backup-manager cert info |grep Fingerprint
914 Fingerprint (sha256): 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe
915
916 Please add that fingerprint to your configuration to establish a trust
917 relationship:
918
919 .. code-block:: console
920
921 # pvesm set store2 --fingerprint 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe
922
923 After that you should be able to see storage status with:
924
925 .. code-block:: console
926
927 # pvesm status --storage store2
928 Name Type Status Total Used Available %
929 store2 pbs active 3905109820 1336687816 2568422004 34.23%
930
931
932
933 .. include:: command-line-tools.rst
934
935 .. include:: services.rst
936
937 .. include host system admin at the end
938
939 .. include:: sysadmin.rst