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