]> git.proxmox.com Git - proxmox-backup.git/blame - docs/administration-guide.rst
Datastore Config: 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
8c6e5ce2 384Proxmox Backup Server supports several authentication realms, and you need to
17ec699d
DM
385choose the realm when you add a new user. Possible realms are:
386
387:pam: Linux PAM standard authentication. Use this if you want to
8c6e5ce2 388 authenticate as Linux system user (Users need to exist on the
17ec699d
DM
389 system).
390
391:pbs: Proxmox Backup Server realm. This type stores hashed passwords in
392 ``/etc/proxmox-backup/shadow.json``.
393
394After installation, there is a single user ``root@pam``, which
395corresponds to the Unix superuser. You can use the
396``proxmox-backup-manager`` command line tool to list or manipulate
397users:
398
399.. code-block:: console
400
401 # proxmox-backup-manager user list
26d29e0e
DM
402 ┌─────────────┬────────┬────────┬───────────┬──────────┬────────────────┬────────────────────┐
403 │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │
404 ╞═════════════╪════════╪════════╪═══════════╪══════════╪════════════════╪════════════════════╡
405 │ root@pam │ 1 │ │ │ │ │ Superuser │
406 └─────────────┴────────┴────────┴───────────┴──────────┴────────────────┴────────────────────┘
17ec699d
DM
407
408The superuser has full administration rights on everything, so you
409normally want to add other users with less privileges:
410
411.. code-block:: console
412
413 # proxmox-backup-manager user create john@pbs --email john@example.com
414
8c6e5ce2
OB
415The create command lets you specify many options like ``--email`` or
416``--password``. You can update or change any of them using the
17ec699d
DM
417update command later:
418
419.. code-block:: console
420
421 # proxmox-backup-manager user update john@pbs --firstname John --lastname Smith
422 # proxmox-backup-manager user update john@pbs --comment "An example user."
423
17ec699d
DM
424.. todo:: Mention how to set password without passing plaintext password as cli argument.
425
426
8c6e5ce2 427The resulting user list looks like this:
17ec699d
DM
428
429.. code-block:: console
430
431 # proxmox-backup-manager user list
432 ┌──────────┬────────┬────────┬───────────┬──────────┬──────────────────┬──────────────────┐
433 │ userid │ enable │ expire │ firstname │ lastname │ email │ comment │
434 ╞══════════╪════════╪════════╪═══════════╪══════════╪══════════════════╪══════════════════╡
435 │ john@pbs │ 1 │ │ John │ Smith │ john@example.com │ An example user. │
436 ├──────────┼────────┼────────┼───────────┼──────────┼──────────────────┼──────────────────┤
437 │ root@pam │ 1 │ │ │ │ │ Superuser │
438 └──────────┴────────┴────────┴───────────┴──────────┴──────────────────┴──────────────────┘
439
8c6e5ce2 440Newly created users do not have any permissions. Please read the next
17ec699d
DM
441section to learn how to set access permissions.
442
8c6e5ce2 443If you want to disable a user account, you can do that by setting ``--enable`` to ``0``
8f3b3cc1
DM
444
445.. code-block:: console
446
447 # proxmox-backup-manager user update john@pbs --enable 0
448
8c6e5ce2 449Or completely remove the user with:
8f3b3cc1
DM
450
451.. code-block:: console
452
453 # proxmox-backup-manager user remove john@pbs
454
455
17ec699d
DM
456Access Control
457~~~~~~~~~~~~~~
458
8c6e5ce2
OB
459By default new users do not have any permission. Instead you need to
460specify what is allowed and what is not. You can do this by assigning
8df51d48
DM
461roles to users on specific objects like datastores or remotes. The
462following roles exist:
463
8c6e5ce2
OB
464**NoAccess**
465 Disable Access - nothing is allowed.
466
8df51d48 467**Admin**
4cda7603 468 Can do anything.
8df51d48
DM
469
470**Audit**
4cda7603 471 Can view things, but is not allowed to change settings.
8df51d48 472
8df51d48
DM
473**DatastoreAdmin**
474 Can do anything on datastores.
475
476**DatastoreAudit**
477 Can view datastore settings and list content. But
478 is not allowed to read the actual data.
479
74fc8447 480**DatastoreReader**
8df51d48
DM
481 Can Inspect datastore content and can do restores.
482
74fc8447 483**DatastoreBackup**
8df51d48
DM
484 Can backup and restore owned backups.
485
486**DatastorePowerUser**
487 Can backup, restore, and prune owned backups.
488
489**RemoteAdmin**
490 Can do anything on remotes.
491
492**RemoteAudit**
493 Can view remote settings.
494
495**RemoteSyncOperator**
496 Is allowed to read data from a remote.
497
1e68497c
DW
498You can use the ``acl`` subcommand to manage and monitor user permissions. For
499example, the command below will add the user ``john@pbs`` as a
500**DatastoreAdmin** for the data store ``store1``, located at ``/backup/disk1/store1``:
501
502.. code-block:: console
503
504 # proxmox-backup-manager acl update /datastore/store1 DatastoreAdmin --userid john@pbs
505
506You can monitor the roles of each user using the following command:
507
508.. code-block:: console
509
510 # proxmox-backup-manager acl list
511 ┌──────────┬──────────────────┬───────────┬────────────────┐
512 │ ugid │ path │ propagate │ roleid │
513 ╞══════════╪══════════════════╪═══════════╪════════════════╡
514 │ john@pbs │ /datastore/disk1 │ 1 │ DatastoreAdmin │
515 └──────────┴──────────────────┴───────────┴────────────────┘
516
517A single user can be assigned multiple permission sets for different data stores.
518
519.. Note::
520 Naming convention is important here. For data stores on the host,
521 you must use the convention ``/datastore/{storename}``. For example, to set
522 permissions for a data store mounted at ``/mnt/backup/disk4/store2``, you would use
523 ``/datastore/store2`` for the path. For remote stores, use the convention
524 ``/remote/{remote}/{storename}``, where ``{remote}`` signifies the name of the
525 remote (see `Remote` below) and ``{storename}`` is the name of the data store on
526 the remote.
17ec699d 527
24b638bd
DW
528Network Management
529~~~~~~~~~~~~~~~~~~
530Proxmox Backup Server provides an interface for network configuration, through the
531``network`` subcommand. This allows you to carry out some basic network
532management tasks such as adding, configuring and removing network interfaces.
533
534To get a list of available interfaces, use the following command:
535
536.. code-block:: console
537
538 # proxmox-backup-manager network list
539 ┌───────┬────────┬───────────┬────────┬─────────┬───────────────────┬──────────────┬──────────────┐
540 │ name │ type │ autostart │ method │ method6 │ address │ gateway │ ports/slaves │
541 ╞═══════╪════════╪═══════════╪════════╪═════════╪═══════════════════╪══════════════╪══════════════╡
542 │ bond0 │ bond │ 1 │ manual │ │ │ │ ens18 ens19 │
543 ├───────┼────────┼───────────┼────────┼─────────┼───────────────────┼──────────────┼──────────────┤
544 │ ens18 │ eth │ 1 │ manual │ │ │ │ │
545 ├───────┼────────┼───────────┼────────┼─────────┼───────────────────┼──────────────┼──────────────┤
546 │ ens19 │ eth │ 1 │ manual │ │ │ │ │
547 ├───────┼────────┼───────────┼────────┼─────────┼───────────────────┼──────────────┼──────────────┤
548 │ vmbr0 │ bridge │ 1 │ static │ │ x.x.x.x/x │ x.x.x.x │ bond0 │
549 └───────┴────────┴───────────┴────────┴─────────┴───────────────────┴──────────────┴──────────────┘
550
551To add a new network interface, use the ``create`` subcommand with the relevant
552parameters. The following command shows a template for creating a new bridge:
553
554.. code-block:: console
555
556 # 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
557
558You can make changes to the configuration of a network interface with the
559``update`` subcommand:
560
561.. code-block:: console
562
563 # proxmox-backup-manager network update vmbr1 --cidr y.y.y.y/y
564
565You can also remove a network interface:
566
567.. code-block:: console
568
569 # proxmox-backup-manager network remove vmbr1
570
571To view the changes made to the network configuration file, before committing
572them, use the command:
573
574.. code-block:: console
575
576 # proxmox-backup-manager network changes
577
578If you would like to cancel all changes at this point, you can do this using:
579
580.. code-block:: console
581
582 # proxmox-backup-manager network revert
583
584If you are happy with the changes and would like to write them into the
585configuration file, the command is:
586
587.. code-block:: console
588
589 # proxmox-backup-manager network reload
590
591You can also configure DNS settings using the ``dns`` subcommand of
592``proxmox-backup-manager``.
593
9634ca07
SI
594:term:`Remote`
595~~~~~~~~~~~~~~
596
aef49768 597A remote refers to a separate Proxmox Backup Server installation and a user on that
9634ca07
SI
598installation, from which you can `sync` datastores to a local datastore with a
599`Sync Job`.
600
aef49768
DW
601To add a remote, you need its hostname or ip, a userid and password on the
602remote, and its certificate fingerprint. To get the fingerprint, use the
603``proxmox-backup-manager cert info`` command on the remote.
9634ca07
SI
604
605.. code-block:: console
606
607 # proxmox-backup-manager cert info |grep Fingerprint
608 Fingerprint (sha256): 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe
609
aef49768 610Using the information specified above, add the remote with:
9634ca07
SI
611
612.. code-block:: console
613
614 # 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
615
616Use the ``list``, ``show``, ``update``, ``remove`` subcommands of
617``proxmox-backup-manager remote`` to manage your remotes:
618
619.. code-block:: console
620
621 # proxmox-backup-manager remote update pbs2 --host pbs2.example
622 # proxmox-backup-manager remote list
623 ┌──────┬──────────────┬──────────┬───────────────────────────────────────────┬─────────┐
624 │ name │ host │ userid │ fingerprint │ comment │
625 ╞══════╪══════════════╪══════════╪═══════════════════════════════════════════╪═════════╡
626 │ pbs2 │ pbs2.example │ sync@pam │64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe │ │
627 └──────┴──────────────┴──────────┴───────────────────────────────────────────┴─────────┘
628 # proxmox-backup-manager remote remove pbs2
629
630
631Sync Jobs
632~~~~~~~~~
633
634Sync jobs are configured to pull the contents of a datastore on a `Remote` to a
635local datastore. You can either start the sync job manually on the GUI or
636provide it with a :term:`schedule` to run regularly. The
637``proxmox-backup-manager sync-job`` command is used to manage sync jobs:
638
639.. code-block:: console
640
641 # proxmox-backup-manager sync-job create pbs2-local --remote pbs2 --remote-store local --store local --schedule 'Wed 02:30'
642 # proxmox-backup-manager sync-job update pbs2-local --comment 'offsite'
643 # proxmox-backup-manager sync-job list
644 ┌────────────┬───────┬────────┬──────────────┬───────────┬─────────┐
645 │ id │ store │ remote │ remote-store │ schedule │ comment │
646 ╞════════════╪═══════╪════════╪══════════════╪═══════════╪═════════╡
647 │ pbs2-local │ local │ pbs2 │ local │ Wed 02:30 │ offsite │
648 └────────────┴───────┴────────┴──────────────┴───────────┴─────────┘
649 # proxmox-backup-manager sync-job remove pbs2-local
650
fd3f6901
DW
651Garbage Collection
652~~~~~~~~~~~~~~~~~~
653You can monitor and run :ref:`garbage collection <garbage-collection>` on the
654Proxmox Backup Server using the ``garbage-collection`` subcommand of
655``proxmox-backup-manager``. You can use the ``start`` subcommand to manually start garbage
656collection on an entire data store and the ``status`` subcommand to see
657attributes relating to the :ref:`garbage collection <garbage-collection>`.
658
9634ca07 659
cb01363c
DM
660Backup Client usage
661-------------------
58ea88c8
DM
662
663The command line client is called :command:`proxmox-backup-client`.
664
a129fdd9 665
0c1c492d
TL
666Repository Locations
667~~~~~~~~~~~~~~~~~~~~
58ea88c8 668
4f3db187 669The client uses the following notation to specify a datastore repository
58ea88c8
DM
670on the backup server.
671
672 [[username@]server:]datastore
673
8c6e5ce2
OB
674The default value for ``username`` ist ``root``. If no server is specified,
675the default is the local host (``localhost``).
58ea88c8 676
4f3db187
AL
677You can pass the repository with the ``--repository`` command
678line option, or by setting the ``PBS_REPOSITORY`` environment
58ea88c8
DM
679variable.
680
681
682Environment Variables
53ea6556 683~~~~~~~~~~~~~~~~~~~~~
58ea88c8
DM
684
685``PBS_REPOSITORY``
686 The default backup repository.
687
688``PBS_PASSWORD``
689 When set, this value is used for the password required for the
690 backup server.
691
692``PBS_ENCRYPTION_PASSWORD``
58ea88c8
DM
693 When set, this value is used to access the secret encryption key (if
694 protected by password).
695
3243f93c
DM
696``PBS_FINGERPRINT`` When set, this value is used to verify the server
697 certificate (only used if the system CA certificates cannot
698 validate the certificate).
699
53ea6556
DM
700
701Output Format
702~~~~~~~~~~~~~
703
4f3db187
AL
704Most commands support the ``--output-format`` parameter. It accepts
705the following values:
53ea6556
DM
706
707:``text``: Text format (default). Structured data is rendered as a table.
708
709:``json``: JSON (single line).
710
711:``json-pretty``: JSON (multiple lines, nicely formatted).
712
713
714Please use the following environment variables to modify output behavior:
715
716``PROXMOX_OUTPUT_FORMAT``
717 Defines the default output format.
718
719``PROXMOX_OUTPUT_NO_BORDER``
720 If set (to any value), do not render table borders.
721
722``PROXMOX_OUTPUT_NO_HEADER``
723 If set (to any value), do not render table headers.
724
4f3db187 725.. note:: The ``text`` format is designed to be human readable, and
53ea6556 726 not meant to be parsed by automation tools. Please use the ``json``
4f3db187 727 format if you need to process the output.
53ea6556
DM
728
729
cee53b34 730.. _creating-backups:
58ea88c8
DM
731
732Creating Backups
733~~~~~~~~~~~~~~~~
734
4f3db187
AL
735This section explains how to create a backup from within the machine. This can
736be a physical host, a virtual machine, or a container. Such backups may contain file
737and image archives. There are no restrictions in this case.
a129fdd9 738
8c6e5ce2 739.. note:: If you want to backup virtual machines or containers on Proxmox VE, see :ref:`pve-integration`.
a129fdd9 740
4f3db187
AL
741For the following example you need to have a backup server set up, working
742credentials and need to know the repository name.
743In the following examples we use ``backup-server:store1``.
a129fdd9
DM
744
745.. code-block:: console
746
747 # proxmox-backup-client backup root.pxar:/ --repository backup-server:store1
748 Starting backup: host/elsa/2019-12-03T09:35:01Z
749 Client name: elsa
750 skip mount point: "/boot/efi"
751 skip mount point: "/dev"
752 skip mount point: "/run"
753 skip mount point: "/sys"
754 Uploaded 12129 chunks in 87 seconds (564 MB/s).
755 End Time: 2019-12-03T10:36:29+01:00
756
757This will prompt you for a password and then uploads a file archive named
758``root.pxar`` containing all the files in the ``/`` directory.
759
4f3db187 760.. Caution:: Please note that the proxmox-backup-client does not
ed858b0a 761 automatically include mount points. Instead, you will see a short
4f3db187
AL
762 ``skip mount point`` notice for each of them. The idea is to
763 create a separate file archive for each mounted disk. You can
a129fdd9
DM
764 explicitly include them using the ``--include-dev`` option
765 (i.e. ``--include-dev /boot/efi``). You can use this option
4f3db187 766 multiple times for each mount point that should be included.
a129fdd9 767
4f3db187 768The ``--repository`` option can get quite long and is used by all
a129fdd9 769commands. You can avoid having to enter this value by setting the
74fc8447
DW
770environment variable ``PBS_REPOSITORY``. Note that if you would like this to remain set
771over multiple sessions, you should instead add the below line to your
772``.bashrc`` file.
a129fdd9
DM
773
774.. code-block:: console
775
78ee20d7 776 # export PBS_REPOSITORY=backup-server:store1
a129fdd9 777
4f3db187 778After this you can execute all commands without specifying the ``--repository``
a129fdd9
DM
779option.
780
4f3db187
AL
781One single backup is allowed to contain more than one archive. For example, if
782you want to backup two disks mounted at ``/mmt/disk1`` and ``/mnt/disk2``:
a129fdd9
DM
783
784.. code-block:: console
785
786 # proxmox-backup-client backup disk1.pxar:/mnt/disk1 disk2.pxar:/mnt/disk2
787
4f3db187 788This creates a backup of both disks.
a129fdd9
DM
789
790The backup command takes a list of backup specifications, which
4f3db187
AL
791include the archive name on the server, the type of the archive, and the
792archive source at the client. The format is:
a129fdd9
DM
793
794 <archive-name>.<type>:<source-path>
795
796Common types are ``.pxar`` for file archives, and ``.img`` for block
4f3db187 797device images. To create a backup of a block device run the following command:
a129fdd9
DM
798
799.. code-block:: console
800
801 # proxmox-backup-client backup mydata.img:/dev/mylvm/mydata
802
50b8f9dd
CE
803Excluding files/folders from a backup
804^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
805
806Sometimes it is desired to exclude certain files or folders from a backup archive.
4cda7603 807To tell the Proxmox Backup client when and how to ignore files and directories,
4f3db187
AL
808place a text file called ``.pxarexclude`` in the filesystem hierarchy.
809Whenever the backup client encounters such a file in a directory, it interprets
810each line as glob match patterns for files and directories that are to be excluded
811from the backup.
812
813The file must contain a single glob pattern per line. Empty lines are ignored.
814The same is true for lines starting with ``#``, which indicates a comment.
815A ``!`` at the beginning of a line reverses the glob match pattern from an exclusion
816to an explicit inclusion. This makes it possible to exclude all entries in a
817directory except for a few single files/subdirectories.
818Lines ending in ``/`` match only on directories.
819The directory containing the ``.pxarexclude`` file is considered to be the root of
820the given patterns. It is only possible to match files in this directory and its subdirectories.
821
822``\`` is used to escape special glob characters.
823``?`` matches any single character.
824``*`` matches any character, including an empty string.
825``**`` is used to match subdirectories. It can be used to, for example, exclude
826all files ending in ``.tmp`` within the directory or subdirectories with the
50b8f9dd
CE
827following pattern ``**/*.tmp``.
828``[...]`` matches a single character from any of the provided characters within
0c1c492d 829the brackets. ``[!...]`` does the complementary and matches any single character
4f3db187
AL
830not contained within the brackets. It is also possible to specify ranges with two
831characters separated by ``-``. For example, ``[a-z]`` matches any lowercase
832alphabetic character and ``[0-9]`` matches any one single digit.
50b8f9dd 833
aef49768
DW
834The order of the glob match patterns defines whether a file is included or
835excluded, that is to say later entries override previous ones.
50b8f9dd 836This is also true for match patterns encountered deeper down the directory tree,
4f3db187
AL
837which can override a previous exclusion.
838Be aware that excluded directories will **not** be read by the backup client.
aef49768 839Thus, a ``.pxarexclude`` file in an excluded subdirectory will have no effect.
4f3db187 840``.pxarexclude`` files are treated as regular files and will be included in the
50b8f9dd
CE
841backup archive.
842
4f3db187 843For example, consider the following directory structure:
50b8f9dd
CE
844
845.. code-block:: console
846
847 # ls -aR folder
848 folder/:
849 . .. .pxarexclude subfolder0 subfolder1
850
851 folder/subfolder0:
852 . .. file0 file1 file2 file3 .pxarexclude
853
854 folder/subfolder1:
855 . .. file0 file1 file2 file3
856
4f3db187 857The different ``.pxarexclude`` files contain the following:
50b8f9dd
CE
858
859.. code-block:: console
860
861 # cat folder/.pxarexclude
862 /subfolder0/file1
863 /subfolder1/*
864 !/subfolder1/file2
865
866.. code-block:: console
867
868 # cat folder/subfolder0/.pxarexclude
869 file3
870
871This would exclude ``file1`` and ``file3`` in ``subfolder0`` and all of
872``subfolder1`` except ``file2``.
873
4f3db187 874Restoring this backup will result in:
50b8f9dd
CE
875
876.. code-block:: console
877
878 ls -aR restored
879 restored/:
880 . .. .pxarexclude subfolder0 subfolder1
881
882 restored/subfolder0:
883 . .. file0 file2 .pxarexclude
884
885 restored/subfolder1:
886 . .. file2
a129fdd9 887
58ea88c8 888Encryption
747c3bc0 889~~~~~~~~~~
58ea88c8 890
aef49768
DW
891Proxmox Backup supports client-side encryption with AES-256 in GCM_
892mode. To set this up, you first need to create an encryption key:
5a499f32
DM
893
894.. code-block:: console
895
896 # proxmox-backup-client key create my-backup.key
897 Encryption Key Password: **************
898
899The key is password protected by default. If you do not need this
900extra protection, you can also create it without a password:
901
902.. code-block:: console
903
4f3db187 904 # proxmox-backup-client key create /path/to/my-backup.key --kdf none
5a499f32 905
16a18dad
DW
906Having created this key, it is now possible to create an encrypted backup, by
907passing the ``--keyfile`` parameter, with the path to the key file.
5a499f32
DM
908
909.. code-block:: console
910
911 # proxmox-backup-client backup etc.pxar:/etc --keyfile /path/to/my-backup.key
912 Password: *********
913 Encryption Key Password: **************
914 ...
915
16a18dad
DW
916.. Note:: If you do not specify the name of the backup key, the key will be
917 created in the default location
918 ``~/.config/proxmox-backup/encryption-key.json``. ``proxmox-backup-client``
919 will also search this location by default, in case the ``--keyfile``
920 parameter is not specified.
5a499f32 921
4f3db187 922You can avoid entering the passwords by setting the environment
5a499f32
DM
923variables ``PBS_PASSWORD`` and ``PBS_ENCRYPTION_PASSWORD``.
924
16a18dad 925Using a master key to store and recover encryption keys
c23e257c 926^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16a18dad
DW
927
928You can also use ``proxmox-backup-client key`` to create an RSA public/private
929key pair, which can be used to store an encrypted version of the symmetric
930backup encryption key alongside each backup and recover it later.
931
932To set up a master key:
933
9341. Create an encryption key for the backup:
935
936 .. code-block:: console
937
938 # proxmox-backup-client key create
939 creating default key at: "~/.config/proxmox-backup/encryption-key.json"
940 Encryption Key Password: **********
941 ...
942
943 The resulting file will be saved to ``~/.config/proxmox-backup/encryption-key.json``.
944
9452. Create an RSA public/private key pair:
946
947 .. code-block:: console
948
949 # proxmox-backup-client key create-master-key
950 Master Key Password: *********
951 ...
952
953 This will create two files in your current directory, ``master-public.pem``
954 and ``master-private.pem``.
955
9563. Import the newly created ``master-public.pem`` public certificate, so that
957 ``proxmox-backup-client`` can find and use it upon backup.
958
959 .. code-block:: console
960
961 # proxmox-backup-client key import-master-pubkey /path/to/master-public.pem
962 Imported public master key to "~/.config/proxmox-backup/master-public.pem"
963
9644. With all these files in place, run a backup job:
965
966 .. code-block:: console
967
968 # proxmox-backup-client backup etc.pxar:/etc
969
970 The key will be stored in your backup, under the name ``rsa-encrypted.key``.
971
972 .. Note:: The ``--keyfile`` parameter can be excluded, if the encryption key
973 is in the default path. If you specified another path upon creation, you
974 must pass the ``--keyfile`` parameter.
975
9765. To test that everything worked, you can restore the key from the backup:
977
978 .. code-block:: console
979
980 # proxmox-backup-client restore /path/to/backup/ rsa-encrypted.key /path/to/target
981
982 .. Note:: You should not need an encryption key to extract this file. However, if
983 a key exists at the default location
984 (``~/.config/proxmox-backup/encryption-key.json``) the program will prompt
985 you for an encryption key password. Simply moving ``encryption-key.json``
986 out of this directory will fix this issue.
987
9886. Then, use the previously generated master key to decrypt the file:
989
990 .. code-block:: console
991
992 # openssl rsautl -decrypt -inkey master-private.pem -in rsa-encrypted.key -out /path/to/target
993 Enter pass phrase for ./master-private.pem: *********
994
9957. The target file will now contain the encryption key information in plain
996 text. The success of this can be confirmed by passing the resulting ``json``
997 file, with the ``--keyfile`` parameter, when decrypting files from the backup.
5a499f32 998
16a18dad
DW
999.. warning:: Without their key, backed up files will be inaccessible. Thus, you should
1000 keep keys ordered and in a place that is separate from the contents being
1001 backed up. It can happen, for example, that you back up an entire system, using
1002 a key on that system. If the system then becomes inaccessable for any reason
1003 and needs to be restored, this will not be possible as the encryption key will be
74fc8447
DW
1004 lost along with the broken system. In preparation for the worst case scenario,
1005 you should consider keeping a paper copy of this key locked away in
1006 a safe place.
58ea88c8
DM
1007
1008Restoring Data
1009~~~~~~~~~~~~~~
1010
aef49768
DW
1011The regular creation of backups is a necessary step to avoiding data
1012loss. More importantly, however, is the restoration. It is good practice to perform
4f3db187 1013periodic recovery tests to ensure that you can access the data in
64b85116
DM
1014case of problems.
1015
4f3db187 1016First, you need to find the snapshot which you want to restore. The snapshot
aef49768 1017command provides a list of all the snapshots on the server:
64b85116
DM
1018
1019.. code-block:: console
1020
1021 # proxmox-backup-client snapshots
96feecd6
DM
1022 ┌────────────────────────────────┬─────────────┬────────────────────────────────────┐
1023 │ snapshot │ size │ files │
1024 ╞════════════════════════════════╪═════════════╪════════════════════════════════════╡
1025 │ host/elsa/2019-12-03T09:30:15Z │ 51788646825 │ root.pxar catalog.pcat1 index.json │
1026 ├────────────────────────────────┼─────────────┼────────────────────────────────────┤
1027 │ host/elsa/2019-12-03T09:35:01Z │ 51790622048 │ root.pxar catalog.pcat1 index.json │
1028 ├────────────────────────────────┼─────────────┼────────────────────────────────────┤
64b85116
DM
1029 ...
1030
4f3db187 1031You can inspect the catalog to find specific files.
64b85116
DM
1032
1033.. code-block:: console
1034
3c50a9d8 1035 # proxmox-backup-client catalog dump host/elsa/2019-12-03T09:35:01Z
64b85116
DM
1036 ...
1037 d "./root.pxar.didx/etc/cifs-utils"
1038 l "./root.pxar.didx/etc/cifs-utils/idmap-plugin"
1039 d "./root.pxar.didx/etc/console-setup"
1040 ...
1041
1042The restore command lets you restore a single archive from the
1043backup.
1044
1045.. code-block:: console
1046
1047 # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z root.pxar /target/path/
1048
4cda7603 1049To get the contents of any archive, you can restore the ``index.json`` file in the
aef49768 1050repository to the target path '-'. This will dump the contents to the standard output.
64b85116
DM
1051
1052.. code-block:: console
1053
1054 # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z index.json -
1055
1056
1057Interactive Restores
1058^^^^^^^^^^^^^^^^^^^^
1059
1060If you only want to restore a few individual files, it is often easier
1061to use the interactive recovery shell.
1062
1063.. code-block:: console
1064
3c50a9d8 1065 # proxmox-backup-client catalog shell host/elsa/2019-12-03T09:35:01Z root.pxar
64b85116
DM
1066 Starting interactive shell
1067 pxar:/ > ls
1068 bin boot dev etc home lib lib32
1069 ...
1070
3f0983b7 1071The interactive recovery shell is a minimalistic command line interface that
4f3db187
AL
1072utilizes the metadata stored in the catalog to quickly list, navigate and
1073search files in a file archive.
1074To restore files, you can select them individually or match them with a glob
1075pattern.
1076
1077Using the catalog for navigation reduces the overhead considerably because only
1078the catalog needs to be downloaded and, optionally, decrypted.
3f0983b7
CE
1079The actual chunks are only accessed if the metadata in the catalog is not enough
1080or for the actual restore.
1081
1082Similar to common UNIX shells ``cd`` and ``ls`` are the commands used to change
4f3db187 1083working directory and list directory contents in the archive.
3f0983b7
CE
1084``pwd`` shows the full path of the current working directory with respect to the
1085archive root.
1086
aef49768 1087Being able to quickly search the contents of the archive is a commmonly needed feature.
3f0983b7
CE
1088That's where the catalog is most valuable.
1089For example:
1090
1091.. code-block:: console
1092
a83674ad 1093 pxar:/ > find etc/**/*.txt --select
3f0983b7
CE
1094 "/etc/X11/rgb.txt"
1095 pxar:/ > list-selected
1096 etc/**/*.txt
1097 pxar:/ > restore-selected /target/path
1098 ...
1099
1100This will find and print all files ending in ``.txt`` located in ``etc/`` or a
1101subdirectory and add the corresponding pattern to the list for subsequent restores.
1102``list-selected`` shows these patterns and ``restore-selected`` finally restores
1103all files in the archive matching the patterns to ``/target/path`` on the local
1104host. This will scan the whole archive.
1105
1106With ``restore /target/path`` you can restore the sub-archive given by the current
1107working directory to the local target path ``/target/path`` on your host.
1108By additionally passing a glob pattern with ``--pattern <glob>``, the restore is
1109further limited to files matching the pattern.
1110For example:
1111
1112.. code-block:: console
1113
1114 pxar:/ > cd /etc/
1115 pxar:/etc/ > restore /target/ --pattern **/*.conf
1116 ...
1117
1118The above will scan trough all the directories below ``/etc`` and restore all
1119files ending in ``.conf``.
1120
1121.. todo:: Explain interactive restore in more detail
64b85116 1122
c7971d7f
CE
1123Mounting of Archives via FUSE
1124^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1125
1126The :term:`FUSE` implementation for the pxar archive allows you to mount a
1127file archive as a read-only filesystem to a mountpoint on your host.
1128
1129.. code-block:: console
1130
74fc8447
DW
1131 # proxmox-backup-client mount host/backup-client/2020-01-29T11:29:22Z root.pxar /mnt/mountpoint
1132 # ls /mnt/mountpoint
c7971d7f
CE
1133 bin dev home lib32 libx32 media opt root sbin sys usr
1134 boot etc lib lib64 lost+found mnt proc run srv tmp var
1135
aef49768 1136This allows you to access the full contents of the archive in a seamless manner.
c7971d7f
CE
1137
1138.. note:: As the FUSE connection needs to fetch and decrypt chunks from the
aef49768 1139 backup server's datastore, this can cause some additional network and CPU
c7971d7f
CE
1140 load on your host, depending on the operations you perform on the mounted
1141 filesystem.
1142
4f3db187 1143To unmount the filesystem use the ``umount`` command on the mountpoint:
c7971d7f
CE
1144
1145.. code-block:: console
1146
74fc8447 1147 # umount /mnt/mountpoint
58ea88c8 1148
ac456d85
DM
1149Login and Logout
1150~~~~~~~~~~~~~~~~
1151
1152The client tool prompts you to enter the logon password as soon as you
1153want to access the backup server. The server checks your credentials
1154and responds with a ticket that is valid for two hours. The client
4f3db187 1155tool automatically stores that ticket and uses it for further requests
ac456d85
DM
1156to this server.
1157
1158You can also manually trigger this login/logout using the login and
1159logout commands:
1160
1161.. code-block:: console
1162
1163 # proxmox-backup-client login
1164 Password: **********
1165
4f3db187 1166To remove the ticket, issue a logout:
ac456d85
DM
1167
1168.. code-block:: console
1169
1170 # proxmox-backup-client logout
1171
1172
22231524
SI
1173.. _pruning:
1174
6e5a0c03
DM
1175Pruning and Removing Backups
1176~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1177
1178You can manually delete a backup snapshot using the ``forget``
1179command:
1180
1181.. code-block:: console
1182
1183 # proxmox-backup-client forget <snapshot>
1184
1185
4f3db187
AL
1186.. caution:: This command removes all archives in this backup
1187 snapshot. They will be inaccessible and unrecoverable.
6e5a0c03
DM
1188
1189
4cda7603
DW
1190Although manual removal is sometimes required, the ``prune``
1191command is normally used to systematically delete older backups. Prune lets
4f3db187
AL
1192you specify which backup snapshots you want to keep. The
1193following retention options are available:
52b2be97
DM
1194
1195``--keep-last <N>``
1196 Keep the last ``<N>`` backup snapshots.
1197
102d8d41 1198``--keep-hourly <N>``
4f3db187
AL
1199 Keep backups for the last ``<N>`` hours. If there is more than one
1200 backup for a single hour, only the latest is kept.
102d8d41 1201
52b2be97 1202``--keep-daily <N>``
4f3db187
AL
1203 Keep backups for the last ``<N>`` days. If there is more than one
1204 backup for a single day, only the latest is kept.
52b2be97
DM
1205
1206``--keep-weekly <N>``
4f3db187
AL
1207 Keep backups for the last ``<N>`` weeks. If there is more than one
1208 backup for a single week, only the latest is kept.
52b2be97 1209
4f3db187
AL
1210 .. note:: Weeks start on Monday and end on Sunday. The software
1211 uses the `ISO week date`_ system and handles weeks at
1212 the end of the year correctly.
1af66370 1213
52b2be97 1214``--keep-monthly <N>``
4f3db187
AL
1215 Keep backups for the last ``<N>`` months. If there is more than one
1216 backup for a single month, only the latest is kept.
52b2be97
DM
1217
1218``--keep-yearly <N>``
4f3db187
AL
1219 Keep backups for the last ``<N>`` years. If there is more than one
1220 backup for a single year, only the latest is kept.
1221
1222The retention options are processed in the order given above. Each option
1223only covers backups within its time period. The next option does not take care
1224of already covered backups. It will only consider older backups.
52b2be97 1225
4f3db187
AL
1226Unfinished and incomplete backups will be removed by the prune command unless
1227they are newer than the last successful backup. In this case, the last failed
1228backup is retained.
02d22dec 1229
6e5a0c03
DM
1230.. code-block:: console
1231
1232 # proxmox-backup-client prune <group> --keep-daily 7 --keep-weekly 4 --keep-monthly 3
1233
1234
4f3db187 1235You can use the ``--dry-run`` option to test your settings. This only
aef49768 1236shows the list of existing snapshots and what actions prune would take.
84322d8c
DM
1237
1238.. code-block:: console
1239
1240 # proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3
a66d5898
DM
1241 ┌────────────────────────────────┬──────┐
1242 │ snapshot │ keep │
1243 ╞════════════════════════════════╪══════╡
1244 │ host/elsa/2019-12-04T13:20:37Z │ 1 │
1245 ├────────────────────────────────┼──────┤
1246 │ host/elsa/2019-12-03T09:35:01Z │ 0 │
1247 ├────────────────────────────────┼──────┤
1248 │ host/elsa/2019-11-22T11:54:47Z │ 1 │
1249 ├────────────────────────────────┼──────┤
1250 │ host/elsa/2019-11-21T12:36:25Z │ 0 │
1251 ├────────────────────────────────┼──────┤
1252 │ host/elsa/2019-11-10T10:42:20Z │ 1 │
1253 └────────────────────────────────┴──────┘
84322d8c 1254
52b2be97 1255.. note:: Neither the ``prune`` command nor the ``forget`` command free space
4f3db187
AL
1256 in the chunk-store. The chunk-store still contains the data blocks. To free
1257 space you need to perform :ref:`garbage-collection`.
6e5a0c03
DM
1258
1259
1260.. _garbage-collection:
1261
1262Garbage Collection
1263~~~~~~~~~~~~~~~~~~
1264
e1c356ec
DM
1265The ``prune`` command removes only the backup index files, not the data
1266from the data store. This task is left to the garbage collection
4f3db187 1267command. It is recommended to carry out garbage collection on a regular basis.
e1c356ec
DM
1268
1269The garbage collection works in two phases. In the first phase, all
1270data blocks that are still in use are marked. In the second phase,
1271unused data blocks are removed.
1272
1273.. note:: This command needs to read all existing backup index files
f0188322
CE
1274 and touches the complete chunk-store. This can take a long time
1275 depending on the number of chunks and the speed of the underlying
e1c356ec
DM
1276 disks.
1277
8314ca9c
AL
1278.. note:: The garbage collection will only remove chunks that haven't been used
1279 for at least one day (exactly 24h 5m). This grace period is necessary because
1280 chunks in use are marked by touching the chunk which updates the ``atime``
1281 (access time) property. Filesystems are mounted with the ``relatime`` option
1282 by default. This results in a better performance by only updating the
1283 ``atime`` property if the last access has been at least 24 hours ago. The
255ed621
TL
1284 downside is, that touching a chunk within these 24 hours will not always
1285 update its ``atime`` property.
8314ca9c 1286
255ed621
TL
1287 Chunks in the grace period will be logged at the end of the garbage
1288 collection task as *Pending removals*.
e1c356ec
DM
1289
1290.. code-block:: console
1291
1292 # proxmox-backup-client garbage-collect
1293 starting garbage collection on store store2
1294 Start GC phase1 (mark used chunks)
1295 Start GC phase2 (sweep unused chunks)
1296 percentage done: 1, chunk count: 219
1297 percentage done: 2, chunk count: 453
1298 ...
1299 percentage done: 99, chunk count: 21188
1300 Removed bytes: 411368505
1301 Removed chunks: 203
1302 Original data bytes: 327160886391
1303 Disk bytes: 52767414743 (16 %)
1304 Disk chunks: 21221
1305 Average chunk size: 2486565
1306 TASK OK
1307
1308
1309.. todo:: howto run garbage-collection at regular intervalls (cron)
6e5a0c03 1310
a8d69fcf
DW
1311Benchmarking
1312~~~~~~~~~~~~
1313The backup client also comes with a benchmarking tool. This tool measures
1314various metrics relating to compression and encryption speeds. You can run a
1315benchmark using the ``benchmark`` subcommand of ``proxmox-backup-client``:
1316
1317.. code-block:: console
1318
1319 # proxmox-backup-client benchmark
1320 Uploaded 656 chunks in 5 seconds.
1321 Time per request: 7659 microseconds.
1322 TLS speed: 547.60 MB/s
1323 SHA256 speed: 585.76 MB/s
1324 Compression speed: 1923.96 MB/s
1325 Decompress speed: 7885.24 MB/s
1326 AES256/GCM speed: 3974.03 MB/s
1327 ┌───────────────────────────────────┬─────────────────────┐
1328 │ Name │ Value │
1329 ╞═══════════════════════════════════╪═════════════════════╡
1330 │ TLS (maximal backup upload speed) │ 547.60 MB/s (93%) │
1331 ├───────────────────────────────────┼─────────────────────┤
1332 │ SHA256 checksum computation speed │ 585.76 MB/s (28%) │
1333 ├───────────────────────────────────┼─────────────────────┤
1334 │ ZStd level 1 compression speed │ 1923.96 MB/s (89%) │
1335 ├───────────────────────────────────┼─────────────────────┤
1336 │ ZStd level 1 decompression speed │ 7885.24 MB/s (98%) │
1337 ├───────────────────────────────────┼─────────────────────┤
1338 │ AES256 GCM encryption speed │ 3974.03 MB/s (104%) │
1339 └───────────────────────────────────┴─────────────────────┘
1340
9624c5ee
DM
1341.. note:: The percentages given in the output table correspond to a
1342 comparison against a Ryzen 7 2700X. The TLS test connects to the
1343 local host, so there is no network involved.
503dd339 1344
a8d69fcf
DW
1345You can also pass the ``--output-format`` parameter to output stats in ``json``,
1346rather than the default table format.
6e5a0c03 1347
a129fdd9
DM
1348.. _pve-integration:
1349
58ea88c8
DM
1350`Proxmox VE`_ integration
1351-------------------------
cb01363c 1352
f9dcfa41
DM
1353You need to define a new storage with type 'pbs' on your `Proxmox VE`_
1354node. The following example uses ``store2`` as storage name, and
1355assumes the server address is ``localhost``, and you want to connect
1356as ``user1@pbs``.
1357
1358.. code-block:: console
1359
1360 # pvesm add pbs store2 --server localhost --datastore store2
1361 # pvesm set store2 --username user1@pbs --password <secret>
1362
1363If your backup server uses a self signed certificate, you need to add
1364the certificate fingerprint to the configuration. You can get the
1365fingerprint by running the following command on the backup server:
1366
1367.. code-block:: console
1368
1369 # proxmox-backup-manager cert info |grep Fingerprint
1370 Fingerprint (sha256): 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe
1371
1372Please add that fingerprint to your configuration to establish a trust
1373relationship:
1374
1375.. code-block:: console
1376
1377 # pvesm set store2 --fingerprint 64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe
1378
1379After that you should be able to see storage status with:
1380
1381.. code-block:: console
1382
1383 # pvesm status --storage store2
1384 Name Type Status Total Used Available %
1385 store2 pbs active 3905109820 1336687816 2568422004 34.23%
1386
1387
cb01363c
DM
1388
1389.. include:: command-line-tools.rst
1390
1391.. include:: services.rst