]>
Commit | Line | Data |
---|---|---|
cb01363c DM |
1 | Administration Guide |
2 | ==================== | |
7e688b71 | 3 | |
85e139b7 | 4 | The administration guide. |
7e688b71 | 5 | |
4f3db187 | 6 | .. todo:: either add a bit more explanation or remove the previous sentence |
c4f1b69f | 7 | |
fea8789c DM |
8 | Terminology |
9 | ----------- | |
10 | ||
85e139b7 DM |
11 | Backup Content |
12 | ~~~~~~~~~~~~~~ | |
13 | ||
14 | When doing deduplication, there are different strategies to get | |
15 | optimal results in terms of performance and/or deduplication rates. | |
4f3db187 | 16 | Depending on the type of data, one can split data into *fixed* or *variable* |
85e139b7 DM |
17 | sized chunks. |
18 | ||
19 | Fixed sized chunking needs almost no CPU performance, and is used to | |
20 | backup virtual machine images. | |
21 | ||
22 | Variable sized chunking needs more CPU power, but is essential to get | |
23 | good deduplication rates for file archives. | |
24 | ||
4f3db187 | 25 | The backup server supports both strategies. |
85e139b7 DM |
26 | |
27 | ||
57905a61 DM |
28 | File Archives: ``<name>.pxar`` |
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
85e139b7 DM |
30 | |
31 | .. see https://moinakg.wordpress.com/2013/06/22/high-performance-content-defined-chunking/ | |
32 | ||
4f3db187 | 33 | A file archive stores a full directory tree. Content is stored using |
85e139b7 | 34 | the :ref:`pxar-format`, split into variable sized chunks. The format |
4f3db187 | 35 | is optimized to achieve good deduplication rates. |
85e139b7 DM |
36 | |
37 | ||
57905a61 DM |
38 | Image Archives: ``<name>.img`` |
39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
85e139b7 DM |
40 | |
41 | This is used for virtual machine images and other large binary | |
42 | data. Content is split into fixed sized chunks. | |
43 | ||
44 | ||
45 | Binary Data (BLOBs) | |
46 | ^^^^^^^^^^^^^^^^^^^ | |
47 | ||
4f3db187 AL |
48 | This type is used to store smaller (< 16MB) binary data such as |
49 | configuration files. Larger files should be stored as image archive. | |
85e139b7 DM |
50 | |
51 | .. caution:: Please do not store all files as BLOBs. Instead, use the | |
52 | file archive to store whole directory trees. | |
53 | ||
54 | ||
57905a61 DM |
55 | Catalog File: ``catalog.pcat1`` |
56 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
57 | ||
4f3db187 AL |
58 | The catalog file is an index for file archives. It contains |
59 | the list of files and is used to speed-up search operations. | |
57905a61 DM |
60 | |
61 | ||
62 | The Manifest: ``index.json`` | |
63 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
64 | ||
4f3db187 AL |
65 | The manifest contains the list of all backup files, their |
66 | sizes and checksums. It is used to verify the consistency of a | |
57905a61 DM |
67 | backup. |
68 | ||
69 | ||
fea8789c DM |
70 | Backup Type |
71 | ~~~~~~~~~~~ | |
72 | ||
73 | The backup server groups backups by *type*, where *type* is one of: | |
74 | ||
75 | ``vm`` | |
a129fdd9 | 76 | This type is used for :term:`virtual machine`\ s. Typically |
4f3db187 | 77 | contains the virtual machine's configuration and an image archive |
fea8789c DM |
78 | for each disk. |
79 | ||
80 | ``ct`` | |
4f3db187 | 81 | This type is used for :term:`container`\ s. Contains the container's |
fea8789c DM |
82 | configuration and a single file archive for the container content. |
83 | ||
84 | ``host`` | |
4f3db187 AL |
85 | This type is used for backups created from within the backed up machine. |
86 | Typically this would be a physical host but could also be a virtual machine | |
87 | or container. Such backups may contain file and image archives, there are no restrictions in this regard. | |
fea8789c DM |
88 | |
89 | ||
90 | Backup ID | |
91 | ~~~~~~~~~ | |
92 | ||
93 | An unique ID. Usually the virtual machine or container ID. ``host`` | |
94 | type backups normally use the hostname. | |
95 | ||
96 | ||
97 | Backup Time | |
98 | ~~~~~~~~~~~ | |
99 | ||
100 | The time when the backup was made. | |
101 | ||
102 | ||
6e5a0c03 DM |
103 | Backup Group |
104 | ~~~~~~~~~~~~ | |
105 | ||
4f3db187 AL |
106 | The tuple ``<type>/<ID>`` is called a backup group. Such a group |
107 | may contain one or more backup snapshots. | |
6e5a0c03 DM |
108 | |
109 | ||
fea8789c DM |
110 | Backup Snapshot |
111 | ~~~~~~~~~~~~~~~ | |
112 | ||
4f3db187 | 113 | The triplet ``<type>/<ID>/<time>`` is called a backup snapshot. It |
fea8789c DM |
114 | uniquely identifies a specific backup within a datastore. |
115 | ||
116 | .. code-block:: console | |
117 | :caption: Backup Snapshot Examples | |
118 | ||
119 | vm/104/2019-10-09T08:01:06Z | |
120 | host/elsa/2019-11-08T09:48:14Z | |
121 | ||
4f3db187 | 122 | As you can see, the time format is RFC3399_ with Coordinated |
fea8789c DM |
123 | Universal Time (UTC_, identified by the trailing *Z*). |
124 | ||
125 | ||
126 | :term:`DataStore` | |
127 | ~~~~~~~~~~~~~~~~~ | |
128 | ||
4f3db187 | 129 | A datastore is a place where backups are stored. The current implementation |
fea8789c | 130 | uses a directory inside a standard unix file system (``ext4``, ``xfs`` |
4f3db187 | 131 | or ``zfs``) to store the backup data. |
fea8789c | 132 | |
4f3db187 | 133 | Datastores are identified by a simple *ID*. You can configure it |
fea8789c DM |
134 | when setting up the backup server. |
135 | ||
136 | ||
cb01363c DM |
137 | Backup Server Management |
138 | ------------------------ | |
58ea88c8 | 139 | |
4f3db187 | 140 | The command line tool to configure and manage the backup server is called |
58ea88c8 DM |
141 | :command:`proxmox-backup-manager`. |
142 | ||
143 | ||
144 | Datastore Configuration | |
145 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
146 | ||
147 | A :term:`datastore` is a place to store backups. You can configure | |
4f3db187 | 148 | multiple datastores. At least one datastore needs to be configured. The datastore is identified by a simple `name` and points to a directory. |
58ea88c8 DM |
149 | |
150 | The following command creates a new datastore called ``store1`` on :file:`/backup/disk1/store1` | |
151 | ||
152 | .. code-block:: console | |
153 | ||
154 | # proxmox-backup-manager datastore create store1 /backup/disk1/store1 | |
155 | ||
4f3db187 | 156 | To list existing datastores run: |
58ea88c8 DM |
157 | |
158 | .. code-block:: console | |
159 | ||
160 | # proxmox-backup-manager datastore list | |
161 | store1 /backup/disk1/store1 | |
162 | ||
4f3db187 | 163 | Finally, it is possible to remove the datastore configuration: |
58ea88c8 DM |
164 | |
165 | .. code-block:: console | |
166 | ||
167 | # proxmox-backup-manager datastore remove store1 | |
168 | ||
4f3db187 | 169 | .. note:: The above command removes only the datastore configuration. It does |
58ea88c8 DM |
170 | not delete any data from the underlying directory. |
171 | ||
172 | ||
fea8789c DM |
173 | File Layout |
174 | ^^^^^^^^^^^ | |
175 | ||
176 | .. todo:: Add datastore file layout example | |
177 | ||
178 | ||
cb01363c DM |
179 | Backup Client usage |
180 | ------------------- | |
58ea88c8 DM |
181 | |
182 | The command line client is called :command:`proxmox-backup-client`. | |
183 | ||
a129fdd9 | 184 | |
58ea88c8 DM |
185 | Respository Locations |
186 | ~~~~~~~~~~~~~~~~~~~~~ | |
187 | ||
4f3db187 | 188 | The client uses the following notation to specify a datastore repository |
58ea88c8 DM |
189 | on the backup server. |
190 | ||
191 | [[username@]server:]datastore | |
192 | ||
4f3db187 AL |
193 | The default value for ``username`` ist ``root``. If no server is specified, the |
194 | default is the local host (``localhost``). | |
58ea88c8 | 195 | |
4f3db187 AL |
196 | You can pass the repository with the ``--repository`` command |
197 | line option, or by setting the ``PBS_REPOSITORY`` environment | |
58ea88c8 DM |
198 | variable. |
199 | ||
200 | ||
201 | Environment Variables | |
53ea6556 | 202 | ~~~~~~~~~~~~~~~~~~~~~ |
58ea88c8 DM |
203 | |
204 | ``PBS_REPOSITORY`` | |
205 | The default backup repository. | |
206 | ||
207 | ``PBS_PASSWORD`` | |
208 | When set, this value is used for the password required for the | |
209 | backup server. | |
210 | ||
211 | ``PBS_ENCRYPTION_PASSWORD`` | |
58ea88c8 DM |
212 | When set, this value is used to access the secret encryption key (if |
213 | protected by password). | |
214 | ||
3243f93c DM |
215 | ``PBS_FINGERPRINT`` When set, this value is used to verify the server |
216 | certificate (only used if the system CA certificates cannot | |
217 | validate the certificate). | |
218 | ||
53ea6556 DM |
219 | |
220 | Output Format | |
221 | ~~~~~~~~~~~~~ | |
222 | ||
4f3db187 AL |
223 | Most commands support the ``--output-format`` parameter. It accepts |
224 | the following values: | |
53ea6556 DM |
225 | |
226 | :``text``: Text format (default). Structured data is rendered as a table. | |
227 | ||
228 | :``json``: JSON (single line). | |
229 | ||
230 | :``json-pretty``: JSON (multiple lines, nicely formatted). | |
231 | ||
232 | ||
233 | Please use the following environment variables to modify output behavior: | |
234 | ||
235 | ``PROXMOX_OUTPUT_FORMAT`` | |
236 | Defines the default output format. | |
237 | ||
238 | ``PROXMOX_OUTPUT_NO_BORDER`` | |
239 | If set (to any value), do not render table borders. | |
240 | ||
241 | ``PROXMOX_OUTPUT_NO_HEADER`` | |
242 | If set (to any value), do not render table headers. | |
243 | ||
4f3db187 | 244 | .. note:: The ``text`` format is designed to be human readable, and |
53ea6556 | 245 | not meant to be parsed by automation tools. Please use the ``json`` |
4f3db187 | 246 | format if you need to process the output. |
53ea6556 DM |
247 | |
248 | ||
cee53b34 | 249 | .. _creating-backups: |
58ea88c8 DM |
250 | |
251 | Creating Backups | |
252 | ~~~~~~~~~~~~~~~~ | |
253 | ||
4f3db187 AL |
254 | This section explains how to create a backup from within the machine. This can |
255 | be a physical host, a virtual machine, or a container. Such backups may contain file | |
256 | and image archives. There are no restrictions in this case. | |
a129fdd9 | 257 | |
4f3db187 | 258 | .. note:: If you want to backup virtual machines or containers on Proxmov VE, see :ref:`pve-integration`. |
a129fdd9 | 259 | |
4f3db187 AL |
260 | For the following example you need to have a backup server set up, working |
261 | credentials and need to know the repository name. | |
262 | In the following examples we use ``backup-server:store1``. | |
a129fdd9 DM |
263 | |
264 | .. code-block:: console | |
265 | ||
266 | # proxmox-backup-client backup root.pxar:/ --repository backup-server:store1 | |
267 | Starting backup: host/elsa/2019-12-03T09:35:01Z | |
268 | Client name: elsa | |
269 | skip mount point: "/boot/efi" | |
270 | skip mount point: "/dev" | |
271 | skip mount point: "/run" | |
272 | skip mount point: "/sys" | |
273 | Uploaded 12129 chunks in 87 seconds (564 MB/s). | |
274 | End Time: 2019-12-03T10:36:29+01:00 | |
275 | ||
276 | This will prompt you for a password and then uploads a file archive named | |
277 | ``root.pxar`` containing all the files in the ``/`` directory. | |
278 | ||
4f3db187 | 279 | .. Caution:: Please note that the proxmox-backup-client does not |
ed858b0a | 280 | automatically include mount points. Instead, you will see a short |
4f3db187 AL |
281 | ``skip mount point`` notice for each of them. The idea is to |
282 | create a separate file archive for each mounted disk. You can | |
a129fdd9 DM |
283 | explicitly include them using the ``--include-dev`` option |
284 | (i.e. ``--include-dev /boot/efi``). You can use this option | |
4f3db187 | 285 | multiple times for each mount point that should be included. |
a129fdd9 | 286 | |
4f3db187 | 287 | The ``--repository`` option can get quite long and is used by all |
a129fdd9 DM |
288 | commands. You can avoid having to enter this value by setting the |
289 | environment variable ``PBS_REPOSITORY``. | |
290 | ||
291 | .. code-block:: console | |
292 | ||
293 | # export PBS_REPOSTORY=backup-server:store1 | |
294 | ||
4f3db187 | 295 | After this you can execute all commands without specifying the ``--repository`` |
a129fdd9 DM |
296 | option. |
297 | ||
4f3db187 AL |
298 | One single backup is allowed to contain more than one archive. For example, if |
299 | you want to backup two disks mounted at ``/mmt/disk1`` and ``/mnt/disk2``: | |
a129fdd9 DM |
300 | |
301 | .. code-block:: console | |
302 | ||
303 | # proxmox-backup-client backup disk1.pxar:/mnt/disk1 disk2.pxar:/mnt/disk2 | |
304 | ||
4f3db187 | 305 | This creates a backup of both disks. |
a129fdd9 DM |
306 | |
307 | The backup command takes a list of backup specifications, which | |
4f3db187 AL |
308 | include the archive name on the server, the type of the archive, and the |
309 | archive source at the client. The format is: | |
a129fdd9 DM |
310 | |
311 | <archive-name>.<type>:<source-path> | |
312 | ||
313 | Common types are ``.pxar`` for file archives, and ``.img`` for block | |
4f3db187 | 314 | device images. To create a backup of a block device run the following command: |
a129fdd9 DM |
315 | |
316 | .. code-block:: console | |
317 | ||
318 | # proxmox-backup-client backup mydata.img:/dev/mylvm/mydata | |
319 | ||
50b8f9dd CE |
320 | Excluding files/folders from a backup |
321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
322 | ||
323 | Sometimes it is desired to exclude certain files or folders from a backup archive. | |
4f3db187 AL |
324 | To tell the Proxmox backup client when and how to ignore files and directories, |
325 | place a text file called ``.pxarexclude`` in the filesystem hierarchy. | |
326 | Whenever the backup client encounters such a file in a directory, it interprets | |
327 | each line as glob match patterns for files and directories that are to be excluded | |
328 | from the backup. | |
329 | ||
330 | The file must contain a single glob pattern per line. Empty lines are ignored. | |
331 | The same is true for lines starting with ``#``, which indicates a comment. | |
332 | A ``!`` at the beginning of a line reverses the glob match pattern from an exclusion | |
333 | to an explicit inclusion. This makes it possible to exclude all entries in a | |
334 | directory except for a few single files/subdirectories. | |
335 | Lines ending in ``/`` match only on directories. | |
336 | The directory containing the ``.pxarexclude`` file is considered to be the root of | |
337 | the given patterns. It is only possible to match files in this directory and its subdirectories. | |
338 | ||
339 | ``\`` is used to escape special glob characters. | |
340 | ``?`` matches any single character. | |
341 | ``*`` matches any character, including an empty string. | |
342 | ``**`` is used to match subdirectories. It can be used to, for example, exclude | |
343 | all files ending in ``.tmp`` within the directory or subdirectories with the | |
50b8f9dd CE |
344 | following pattern ``**/*.tmp``. |
345 | ``[...]`` matches a single character from any of the provided characters within | |
346 | the brackets. ``[!...]`` does the complementary and matches any singe character | |
4f3db187 AL |
347 | not contained within the brackets. It is also possible to specify ranges with two |
348 | characters separated by ``-``. For example, ``[a-z]`` matches any lowercase | |
349 | alphabetic character and ``[0-9]`` matches any one single digit. | |
50b8f9dd | 350 | |
4f3db187 | 351 | The order of the glob match patterns defines if a file is included or |
50b8f9dd CE |
352 | excluded, later entries win over previous ones. |
353 | This is also true for match patterns encountered deeper down the directory tree, | |
4f3db187 AL |
354 | which can override a previous exclusion. |
355 | Be aware that excluded directories will **not** be read by the backup client. | |
356 | A ``.pxarexclude`` file in a subdirectory will have no effect. | |
357 | ``.pxarexclude`` files are treated as regular files and will be included in the | |
50b8f9dd CE |
358 | backup archive. |
359 | ||
4f3db187 | 360 | For example, consider the following directory structure: |
50b8f9dd CE |
361 | |
362 | .. code-block:: console | |
363 | ||
364 | # ls -aR folder | |
365 | folder/: | |
366 | . .. .pxarexclude subfolder0 subfolder1 | |
367 | ||
368 | folder/subfolder0: | |
369 | . .. file0 file1 file2 file3 .pxarexclude | |
370 | ||
371 | folder/subfolder1: | |
372 | . .. file0 file1 file2 file3 | |
373 | ||
4f3db187 | 374 | The different ``.pxarexclude`` files contain the following: |
50b8f9dd CE |
375 | |
376 | .. code-block:: console | |
377 | ||
378 | # cat folder/.pxarexclude | |
379 | /subfolder0/file1 | |
380 | /subfolder1/* | |
381 | !/subfolder1/file2 | |
382 | ||
383 | .. code-block:: console | |
384 | ||
385 | # cat folder/subfolder0/.pxarexclude | |
386 | file3 | |
387 | ||
388 | This would exclude ``file1`` and ``file3`` in ``subfolder0`` and all of | |
389 | ``subfolder1`` except ``file2``. | |
390 | ||
4f3db187 | 391 | Restoring this backup will result in: |
50b8f9dd CE |
392 | |
393 | .. code-block:: console | |
394 | ||
395 | ls -aR restored | |
396 | restored/: | |
397 | . .. .pxarexclude subfolder0 subfolder1 | |
398 | ||
399 | restored/subfolder0: | |
400 | . .. file0 file2 .pxarexclude | |
401 | ||
402 | restored/subfolder1: | |
403 | . .. file2 | |
a129fdd9 | 404 | |
58ea88c8 DM |
405 | Encryption |
406 | ^^^^^^^^^^ | |
407 | ||
4f3db187 AL |
408 | Proxmox backup supports client side encryption with AES-256 in GCM_ |
409 | mode. First you need to create an encryption key: | |
5a499f32 DM |
410 | |
411 | .. code-block:: console | |
412 | ||
413 | # proxmox-backup-client key create my-backup.key | |
414 | Encryption Key Password: ************** | |
415 | ||
416 | The key is password protected by default. If you do not need this | |
417 | extra protection, you can also create it without a password: | |
418 | ||
419 | .. code-block:: console | |
420 | ||
4f3db187 | 421 | # proxmox-backup-client key create /path/to/my-backup.key --kdf none |
5a499f32 DM |
422 | |
423 | ||
424 | .. code-block:: console | |
425 | ||
426 | # proxmox-backup-client backup etc.pxar:/etc --keyfile /path/to/my-backup.key | |
427 | Password: ********* | |
428 | Encryption Key Password: ************** | |
429 | ... | |
430 | ||
431 | ||
4f3db187 | 432 | You can avoid entering the passwords by setting the environment |
5a499f32 DM |
433 | variables ``PBS_PASSWORD`` and ``PBS_ENCRYPTION_PASSWORD``. |
434 | ||
435 | .. todo:: Explain master-key | |
436 | ||
58ea88c8 DM |
437 | |
438 | Restoring Data | |
439 | ~~~~~~~~~~~~~~ | |
440 | ||
64b85116 | 441 | The regular creation of backups is a necessary step to avoid data |
4f3db187 AL |
442 | loss. More important, however, is the restoration. It is good practice to perform |
443 | periodic recovery tests to ensure that you can access the data in | |
64b85116 DM |
444 | case of problems. |
445 | ||
4f3db187 AL |
446 | First, you need to find the snapshot which you want to restore. The snapshot |
447 | command gives a list of all snapshots on the server: | |
64b85116 DM |
448 | |
449 | .. code-block:: console | |
450 | ||
451 | # proxmox-backup-client snapshots | |
452 | ... | |
453 | host/elsa/2019-12-03T09:30:15Z | 51788646825 | root.pxar catalog.pcat1 index.json | |
454 | host/elsa/2019-12-03T09:35:01Z | 51790622048 | root.pxar catalog.pcat1 index.json | |
455 | ... | |
456 | ||
4f3db187 | 457 | You can inspect the catalog to find specific files. |
64b85116 DM |
458 | |
459 | .. code-block:: console | |
460 | ||
3c50a9d8 | 461 | # proxmox-backup-client catalog dump host/elsa/2019-12-03T09:35:01Z |
64b85116 DM |
462 | ... |
463 | d "./root.pxar.didx/etc/cifs-utils" | |
464 | l "./root.pxar.didx/etc/cifs-utils/idmap-plugin" | |
465 | d "./root.pxar.didx/etc/console-setup" | |
466 | ... | |
467 | ||
468 | The restore command lets you restore a single archive from the | |
469 | backup. | |
470 | ||
471 | .. code-block:: console | |
472 | ||
473 | # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z root.pxar /target/path/ | |
474 | ||
4f3db187 AL |
475 | To get the contents of any archive you can restore the ``ìndex.json`` file in the |
476 | repository and restore it to '-'. This will dump the content to the standard output. | |
64b85116 DM |
477 | |
478 | .. code-block:: console | |
479 | ||
480 | # proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z index.json - | |
481 | ||
482 | ||
483 | Interactive Restores | |
484 | ^^^^^^^^^^^^^^^^^^^^ | |
485 | ||
486 | If you only want to restore a few individual files, it is often easier | |
487 | to use the interactive recovery shell. | |
488 | ||
489 | .. code-block:: console | |
490 | ||
3c50a9d8 | 491 | # proxmox-backup-client catalog shell host/elsa/2019-12-03T09:35:01Z root.pxar |
64b85116 DM |
492 | Starting interactive shell |
493 | pxar:/ > ls | |
494 | bin boot dev etc home lib lib32 | |
495 | ... | |
496 | ||
3f0983b7 | 497 | The interactive recovery shell is a minimalistic command line interface that |
4f3db187 AL |
498 | utilizes the metadata stored in the catalog to quickly list, navigate and |
499 | search files in a file archive. | |
500 | To restore files, you can select them individually or match them with a glob | |
501 | pattern. | |
502 | ||
503 | Using the catalog for navigation reduces the overhead considerably because only | |
504 | the catalog needs to be downloaded and, optionally, decrypted. | |
3f0983b7 CE |
505 | The actual chunks are only accessed if the metadata in the catalog is not enough |
506 | or for the actual restore. | |
507 | ||
508 | Similar to common UNIX shells ``cd`` and ``ls`` are the commands used to change | |
4f3db187 | 509 | working directory and list directory contents in the archive. |
3f0983b7 CE |
510 | ``pwd`` shows the full path of the current working directory with respect to the |
511 | archive root. | |
512 | ||
513 | Being able to quickly search the contents of the archive is a often needed feature. | |
514 | That's where the catalog is most valuable. | |
515 | For example: | |
516 | ||
517 | .. code-block:: console | |
518 | ||
519 | pxar:/ > find etc/ **/*.txt --select | |
520 | "/etc/X11/rgb.txt" | |
521 | pxar:/ > list-selected | |
522 | etc/**/*.txt | |
523 | pxar:/ > restore-selected /target/path | |
524 | ... | |
525 | ||
526 | This will find and print all files ending in ``.txt`` located in ``etc/`` or a | |
527 | subdirectory and add the corresponding pattern to the list for subsequent restores. | |
528 | ``list-selected`` shows these patterns and ``restore-selected`` finally restores | |
529 | all files in the archive matching the patterns to ``/target/path`` on the local | |
530 | host. This will scan the whole archive. | |
531 | ||
532 | With ``restore /target/path`` you can restore the sub-archive given by the current | |
533 | working directory to the local target path ``/target/path`` on your host. | |
534 | By additionally passing a glob pattern with ``--pattern <glob>``, the restore is | |
535 | further limited to files matching the pattern. | |
536 | For example: | |
537 | ||
538 | .. code-block:: console | |
539 | ||
540 | pxar:/ > cd /etc/ | |
541 | pxar:/etc/ > restore /target/ --pattern **/*.conf | |
542 | ... | |
543 | ||
544 | The above will scan trough all the directories below ``/etc`` and restore all | |
545 | files ending in ``.conf``. | |
546 | ||
547 | .. todo:: Explain interactive restore in more detail | |
64b85116 | 548 | |
c7971d7f CE |
549 | Mounting of Archives via FUSE |
550 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
551 | ||
552 | The :term:`FUSE` implementation for the pxar archive allows you to mount a | |
553 | file archive as a read-only filesystem to a mountpoint on your host. | |
554 | ||
555 | .. code-block:: console | |
556 | ||
557 | # proxmox-backup-client mount host/backup-client/2020-01-29T11:29:22Z root.pxar /mnt | |
558 | # ls /mnt | |
559 | bin dev home lib32 libx32 media opt root sbin sys usr | |
560 | boot etc lib lib64 lost+found mnt proc run srv tmp var | |
561 | ||
562 | This allows you to access the full content of the archive in a seamless manner. | |
563 | ||
564 | .. note:: As the FUSE connection needs to fetch and decrypt chunks from the | |
565 | backup servers datastore, this can cause some additional network and CPU | |
566 | load on your host, depending on the operations you perform on the mounted | |
567 | filesystem. | |
568 | ||
4f3db187 | 569 | To unmount the filesystem use the ``umount`` command on the mountpoint: |
c7971d7f CE |
570 | |
571 | .. code-block:: console | |
572 | ||
573 | # umount /mnt | |
58ea88c8 | 574 | |
ac456d85 DM |
575 | Login and Logout |
576 | ~~~~~~~~~~~~~~~~ | |
577 | ||
578 | The client tool prompts you to enter the logon password as soon as you | |
579 | want to access the backup server. The server checks your credentials | |
580 | and responds with a ticket that is valid for two hours. The client | |
4f3db187 | 581 | tool automatically stores that ticket and uses it for further requests |
ac456d85 DM |
582 | to this server. |
583 | ||
584 | You can also manually trigger this login/logout using the login and | |
585 | logout commands: | |
586 | ||
587 | .. code-block:: console | |
588 | ||
589 | # proxmox-backup-client login | |
590 | Password: ********** | |
591 | ||
4f3db187 | 592 | To remove the ticket, issue a logout: |
ac456d85 DM |
593 | |
594 | .. code-block:: console | |
595 | ||
596 | # proxmox-backup-client logout | |
597 | ||
598 | ||
6e5a0c03 DM |
599 | Pruning and Removing Backups |
600 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
601 | ||
602 | You can manually delete a backup snapshot using the ``forget`` | |
603 | command: | |
604 | ||
605 | .. code-block:: console | |
606 | ||
607 | # proxmox-backup-client forget <snapshot> | |
608 | ||
609 | ||
4f3db187 AL |
610 | .. caution:: This command removes all archives in this backup |
611 | snapshot. They will be inaccessible and unrecoverable. | |
6e5a0c03 DM |
612 | |
613 | ||
4f3db187 | 614 | The manual removal is sometimes required, but normally the prune |
52b2be97 | 615 | command is used to systematically delete older backups. Prune lets |
4f3db187 AL |
616 | you specify which backup snapshots you want to keep. The |
617 | following retention options are available: | |
52b2be97 DM |
618 | |
619 | ``--keep-last <N>`` | |
620 | Keep the last ``<N>`` backup snapshots. | |
621 | ||
102d8d41 | 622 | ``--keep-hourly <N>`` |
4f3db187 AL |
623 | Keep backups for the last ``<N>`` hours. If there is more than one |
624 | backup for a single hour, only the latest is kept. | |
102d8d41 | 625 | |
52b2be97 | 626 | ``--keep-daily <N>`` |
4f3db187 AL |
627 | Keep backups for the last ``<N>`` days. If there is more than one |
628 | backup for a single day, only the latest is kept. | |
52b2be97 DM |
629 | |
630 | ``--keep-weekly <N>`` | |
4f3db187 AL |
631 | Keep backups for the last ``<N>`` weeks. If there is more than one |
632 | backup for a single week, only the latest is kept. | |
52b2be97 | 633 | |
4f3db187 AL |
634 | .. note:: Weeks start on Monday and end on Sunday. The software |
635 | uses the `ISO week date`_ system and handles weeks at | |
636 | the end of the year correctly. | |
1af66370 | 637 | |
52b2be97 | 638 | ``--keep-monthly <N>`` |
4f3db187 AL |
639 | Keep backups for the last ``<N>`` months. If there is more than one |
640 | backup for a single month, only the latest is kept. | |
52b2be97 DM |
641 | |
642 | ``--keep-yearly <N>`` | |
4f3db187 AL |
643 | Keep backups for the last ``<N>`` years. If there is more than one |
644 | backup for a single year, only the latest is kept. | |
645 | ||
646 | The retention options are processed in the order given above. Each option | |
647 | only covers backups within its time period. The next option does not take care | |
648 | of already covered backups. It will only consider older backups. | |
52b2be97 | 649 | |
4f3db187 AL |
650 | For example, the ``--keep-monthly`` option does not consider any backup that is |
651 | younger than one month. | |
52b2be97 | 652 | |
4f3db187 | 653 | .. todo:: check if the previous statement is correct |
52b2be97 | 654 | |
4f3db187 AL |
655 | Unfinished and incomplete backups will be removed by the prune command unless |
656 | they are newer than the last successful backup. In this case, the last failed | |
657 | backup is retained. | |
02d22dec | 658 | |
6e5a0c03 DM |
659 | .. code-block:: console |
660 | ||
661 | # proxmox-backup-client prune <group> --keep-daily 7 --keep-weekly 4 --keep-monthly 3 | |
662 | ||
663 | ||
4f3db187 AL |
664 | You can use the ``--dry-run`` option to test your settings. This only |
665 | shows the list of existing snapshots and which action prune would take. | |
84322d8c DM |
666 | |
667 | .. code-block:: console | |
668 | ||
669 | # proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3 | |
236a396a DM |
670 | retention options: --keep-daily 1 --keep-weekly 3 |
671 | Testing prune on store "store2" group "host/elsa" | |
84322d8c DM |
672 | host/elsa/2019-12-04T13:20:37Z keep |
673 | host/elsa/2019-12-03T09:35:01Z remove | |
674 | host/elsa/2019-11-22T11:54:47Z keep | |
675 | host/elsa/2019-11-21T12:36:25Z remove | |
676 | host/elsa/2019-11-10T10:42:20Z keep | |
677 | ||
678 | ||
52b2be97 | 679 | .. note:: Neither the ``prune`` command nor the ``forget`` command free space |
4f3db187 AL |
680 | in the chunk-store. The chunk-store still contains the data blocks. To free |
681 | space you need to perform :ref:`garbage-collection`. | |
6e5a0c03 DM |
682 | |
683 | ||
684 | .. _garbage-collection: | |
685 | ||
686 | Garbage Collection | |
687 | ~~~~~~~~~~~~~~~~~~ | |
688 | ||
e1c356ec DM |
689 | The ``prune`` command removes only the backup index files, not the data |
690 | from the data store. This task is left to the garbage collection | |
4f3db187 | 691 | command. It is recommended to carry out garbage collection on a regular basis. |
e1c356ec DM |
692 | |
693 | The garbage collection works in two phases. In the first phase, all | |
694 | data blocks that are still in use are marked. In the second phase, | |
695 | unused data blocks are removed. | |
696 | ||
697 | .. note:: This command needs to read all existing backup index files | |
f0188322 CE |
698 | and touches the complete chunk-store. This can take a long time |
699 | depending on the number of chunks and the speed of the underlying | |
e1c356ec DM |
700 | disks. |
701 | ||
702 | ||
703 | .. code-block:: console | |
704 | ||
705 | # proxmox-backup-client garbage-collect | |
706 | starting garbage collection on store store2 | |
707 | Start GC phase1 (mark used chunks) | |
708 | Start GC phase2 (sweep unused chunks) | |
709 | percentage done: 1, chunk count: 219 | |
710 | percentage done: 2, chunk count: 453 | |
711 | ... | |
712 | percentage done: 99, chunk count: 21188 | |
713 | Removed bytes: 411368505 | |
714 | Removed chunks: 203 | |
715 | Original data bytes: 327160886391 | |
716 | Disk bytes: 52767414743 (16 %) | |
717 | Disk chunks: 21221 | |
718 | Average chunk size: 2486565 | |
719 | TASK OK | |
720 | ||
721 | ||
722 | .. todo:: howto run garbage-collection at regular intervalls (cron) | |
6e5a0c03 DM |
723 | |
724 | ||
a129fdd9 DM |
725 | .. _pve-integration: |
726 | ||
58ea88c8 DM |
727 | `Proxmox VE`_ integration |
728 | ------------------------- | |
cb01363c DM |
729 | |
730 | ||
731 | .. include:: command-line-tools.rst | |
732 | ||
733 | .. include:: services.rst | |
85325c25 DM |
734 | |
735 | .. include host system admin at the end | |
736 | ||
737 | .. include:: sysadmin.rst |