]> git.proxmox.com Git - proxmox-backup.git/blame - docs/tape-backup.rst
docs: add documentation about the 'sync-level' tuning
[proxmox-backup.git] / docs / tape-backup.rst
CommitLineData
225affc9
DM
1.. _tape_backup:
2
5f79dc28
DM
3Tape Backup
4===========
5
53939bb4
DW
6.. image:: images/screenshots/pbs-gui-tape-changer-overview.png
7 :align: right
8 :alt: Tape Backup: Tape changer overview
9
66d06696
DC
10Proxmox tape backup provides an easy way to store datastore content
11onto magnetic tapes. This increases data safety because you get:
5f79dc28 12
70d00e01
DW
13- an additional copy of the data,
14- on a different media type (tape),
02633961 15- to an additional location (you can move tapes off-site)
5f79dc28 16
66d06696 17In most restore jobs, only data from the last backup job is restored.
70d00e01 18Restore requests further decline, the older the data
0bce2118 19gets. Considering this, tape backup may also help to reduce disk
70d00e01
DW
20usage, because you can safely remove data from disk, once it's archived on
21tape. This is especially true if you need to retain data for several
0bce2118 22years.
54d96866
DM
23
24Tape backups do not provide random access to the stored data. Instead,
70d00e01 25you need to restore the data to disk, before you can access it
02633961 26again. Also, if you store your tapes off-site (using some kind of tape
70d00e01
DW
27vaulting service), you need to bring them back on-site, before you can do any
28restores. So please consider that restoring from tape can take much
29longer than restoring from disk.
5f79dc28
DM
30
31
32Tape Technology Primer
33----------------------
34
70d00e01 35.. _Linear Tape-Open: https://en.wikipedia.org/wiki/Linear_Tape-Open
5f79dc28 36
70d00e01
DW
37As of 2021, the only widely available tape technology standard is
38`Linear Tape-Open`_ (LTO). Different vendors offer LTO Ultrium tape
39drives, auto-loaders, and LTO tape cartridges.
54d96866 40
70d00e01
DW
41There are a few vendors that offer proprietary drives with
42slight advantages in performance and capacity. Nevertheless, they have
66d06696 43significant disadvantages:
54d96866
DM
44
45- proprietary (single vendor)
46- a much higher purchase cost
47
66d06696 48So we currently do not test such drives.
5f79dc28
DM
49
50In general, LTO tapes offer the following advantages:
51
70d00e01 52- Durability (30 year lifespan)
5f79dc28
DM
53- High Capacity (12 TB)
54- Relatively low cost per TB
55- Cold Media
56- Movable (storable inside vault)
57- Multiple vendors (for both media and drives)
53939bb4 58- Built in AES-GCM Encryption engine
d5efa18a 59
02633961
TL
60Note that `Proxmox Backup Server` already stores compressed data, so using the
61tape compression feature has no advantage.
54d96866 62
d5efa18a
DM
63
64Supported Hardware
65------------------
66
ae5b1e18
DC
67Proxmox Backup Server supports `Linear Tape-Open`_ generation 5 (LTO-5)
68or later and has best-effort support for generation 4 (LTO-4). While
69many LTO-4 systems are known to work, some might need firmware updates or
70do not implement necessary features to work with Proxmox Backup Server.
d5efa18a 71
ee9fa953
DM
72Tape changing is carried out using the SCSI Medium Changer protocol,
73so all modern tape libraries should work.
74
75.. Note:: We use a custom user space tape driver written in Rust_. This
76 driver directly communicates with the tape drive using the SCSI
53939bb4
DW
77 generic interface. This may have negative side effects when used with the old
78 Linux kernel tape driver, so you should not use that driver with
ee9fa953 79 Proxmox tape backup.
d5efa18a
DM
80
81
8a192bed
DM
82Drive Performance
83~~~~~~~~~~~~~~~~~
84
70d00e01 85Current LTO-8 tapes provide read/write speeds of up to 360 MB/s. This means,
66d06696 86that it still takes a minimum of 9 hours to completely write or
8a192bed
DM
87read a single tape (even at maximum speed).
88
53939bb4 89The only way to speed that data rate up is to use more than one
70d00e01 90drive. That way, you can run several backup jobs in parallel, or run
8a192bed
DM
91restore jobs while the other dives are used for backups.
92
70d00e01
DW
93Also consider that you first need to read data from your datastore
94(disk). However, a single spinning disk is unable to deliver data at this
66d06696 95rate. We measured a maximum rate of about 60MB/s to 100MB/s in practice,
70d00e01
DW
96so it takes 33 hours to read the 12TB needed to fill up an LTO-8 tape. If you want
97to write to your tape at full speed, please make sure that the source
53939bb4 98datastore is able to deliver that performance (for example, by using SSDs).
baefbc44 99
d5efa18a
DM
100
101Terminology
102-----------
103
10439718
DM
104**Tape Labels:**
105 are used to uniquely identify a tape. You would normally apply a
106 sticky paper label to the front of the cartridge. We additionally
107 store the label text magnetically on the tape (first file on tape).
d5efa18a
DM
108
109.. _Code 39: https://en.wikipedia.org/wiki/Code_39
110
111.. _LTO Ultrium Cartridge Label Specification: https://www.ibm.com/support/pages/ibm-lto-ultrium-cartridge-label-specification
112
8001c82e
DM
113.. _LTO Barcode Generator: lto-barcode/index.html
114
10439718
DM
115**Barcodes:**
116 are a special form of tape labels, which are electronically
117 readable. Most LTO tape robots use an 8 character string encoded as
118 `Code 39`_, as defined in the `LTO Ultrium Cartridge Label
119 Specification`_.
d5efa18a 120
10439718
DM
121 You can either buy such barcode labels from your cartridge vendor,
122 or print them yourself. You can use our `LTO Barcode Generator`_
123 app, if you would like to print them yourself.
d5efa18a 124
10439718
DM
125 .. Note:: Physical labels and the associated adhesive should have an
126 environmental performance to match or exceed the environmental
127 specifications of the cartridge to which it is applied.
d5efa18a 128
10439718
DM
129**Media Pools:**
130 A media pool is a logical container for tapes. A backup job targets
131 one media pool, so a job only uses tapes from that pool. The pool
132 additionally defines how long a backup job can append data to tapes
133 (allocation policy) and how long you want to keep the data
134 (retention policy).
08d8b2a4 135
10439718
DM
136**Media Set:**
137 A group of continuously written tapes (all from the same media pool).
d5efa18a 138
10439718
DM
139**Tape drive:**
140 The device used to read and write data to the tape. There are
141 standalone drives, but drives are usually shipped within tape
142 libraries.
d5efa18a 143
10439718
DM
144**Tape changer:**
145 A device which can change the tapes inside a tape drive (tape
146 robot). They are usually part of a tape library.
d5efa18a
DM
147
148.. _Tape Library: https://en.wikipedia.org/wiki/Tape_library
149
10439718
DM
150`Tape library`_:
151 A storage device that contains one or more tape drives, a number of
152 slots to hold tape cartridges, a barcode reader to identify tape
153 cartridges, and an automated method for loading tapes (a robot).
d5efa18a 154
10439718
DM
155 This is also commonly known as an 'autoloader', 'tape robot' or
156 'tape jukebox'.
8a192bed 157
10439718
DM
158**Inventory:**
159 The inventory stores the list of known tapes (with additional status
160 information).
4cfb1234 161
10439718
DM
162**Catalog:**
163 A media catalog stores information about the media content.
4cfb1234 164
8a192bed 165
70d00e01 166Tape Quick Start
aae5db91 167----------------
8a192bed
DM
168
1691. Configure your tape hardware (drives and changers)
170
1712. Configure one or more media pools
172
70d00e01 1733. Label your tape cartridges
8a192bed
DM
174
1754. Start your first tape backup job ...
baefbc44
DM
176
177
178Configuration
179-------------
180
181Please note that you can configure anything using the graphical user
70d00e01 182interface or the command line interface. Both methods result in the
baefbc44
DM
183same configuration.
184
225affc9 185.. _tape_changer_config:
baefbc44
DM
186
187Tape changers
188~~~~~~~~~~~~~
189
53939bb4
DW
190.. image:: images/screenshots/pbs-gui-tape-changers.png
191 :align: right
192 :alt: Tape Backup: Tape Changers
193
295bae14
TL
194Tape changers (robots) are part of a `Tape Library`_. They contain a number of
195slots to hold tape cartridges, a barcode reader to identify tape cartridges and
196an automated method for loading tapes.
197
198You can skip this step if you are using a standalone drive.
baefbc44 199
70d00e01 200Linux is able to auto detect these devices, and you can get a list
98cdee78
DM
201of available devices using:
202
203.. code-block:: console
baefbc44
DM
204
205 # proxmox-tape changer scan
a174854a
DM
206 ┌─────────────────────────────┬─────────┬──────────────┬────────┐
207 │ path │ vendor │ model │ serial │
208 ╞═════════════════════════════╪═════════╪══════════════╪════════╡
209 │ /dev/tape/by-id/scsi-CC2C52 │ Quantum │ Superloader3 │ CC2C52 │
210 └─────────────────────────────┴─────────┴──────────────┴────────┘
baefbc44 211
70d00e01 212In order to use a device with Proxmox Backup Server, you need to create a
98cdee78
DM
213configuration entry:
214
215.. code-block:: console
baefbc44 216
a174854a 217 # proxmox-tape changer create sl3 --path /dev/tape/by-id/scsi-CC2C52
baefbc44
DM
218
219Where ``sl3`` is an arbitrary name you can choose.
220
70d00e01 221.. Note:: Please use the persistent device path names from inside
baefbc44
DM
222 ``/dev/tape/by-id/``. Names like ``/dev/sg0`` may point to a
223 different device after reboot, and that is not what you want.
224
53939bb4
DW
225.. image:: images/screenshots/pbs-gui-tape-changers-add.png
226 :align: right
227 :alt: Tape Backup: Add a new tape changer
228
229This operation can also be carried out from the GUI, by navigating to the
230**Changers** tab of **Tape Backup** and clicking **Add**.
231
70d00e01 232You can display the final configuration with:
98cdee78
DM
233
234.. code-block:: console
baefbc44 235
04eba29c
DM
236 # proxmox-tape changer config sl3
237 ┌──────┬─────────────────────────────┐
238 │ Name │ Value │
239 ╞══════╪═════════════════════════════╡
240 │ name │ sl3 │
241 ├──────┼─────────────────────────────┤
242 │ path │ /dev/tape/by-id/scsi-CC2C52 │
243 └──────┴─────────────────────────────┘
244
53939bb4
DW
245Or simply list all configured changer devices (as seen in the **Changers** tab
246of the GUI):
98cdee78
DM
247
248.. code-block:: console
04eba29c 249
baefbc44 250 # proxmox-tape changer list
a174854a
DM
251 ┌──────┬─────────────────────────────┬─────────┬──────────────┬────────────┐
252 │ name │ path │ vendor │ model │ serial │
253 ╞══════╪═════════════════════════════╪═════════╪══════════════╪════════════╡
254 │ sl3 │ /dev/tape/by-id/scsi-CC2C52 │ Quantum │ Superloader3 │ CC2C52 │
255 └──────┴─────────────────────────────┴─────────┴──────────────┴────────────┘
baefbc44 256
53939bb4 257The Vendor, Model and Serial number are auto-detected, but only shown
baefbc44
DM
258if the device is online.
259
98cdee78
DM
260To test your setup, please query the status of the changer device with:
261
262.. code-block:: console
a174854a
DM
263
264 # proxmox-tape changer status sl3
265 ┌───────────────┬──────────┬────────────┬─────────────┐
266 │ entry-kind │ entry-id │ changer-id │ loaded-slot │
267 ╞═══════════════╪══════════╪════════════╪═════════════╡
268 │ drive │ 0 │ vtape1 │ 1 │
269 ├───────────────┼──────────┼────────────┼─────────────┤
270 │ slot │ 1 │ │ │
271 ├───────────────┼──────────┼────────────┼─────────────┤
272 │ slot │ 2 │ vtape2 │ │
273 ├───────────────┼──────────┼────────────┼─────────────┤
274 │ ... │ ... │ │ │
275 ├───────────────┼──────────┼────────────┼─────────────┤
276 │ slot │ 16 │ │ │
277 └───────────────┴──────────┴────────────┴─────────────┘
278
0912878e 279Tape libraries usually provide some special import/export slots (also
02633961 280called "mail slots"). Tapes inside those slots are accessible from
0912878e
DM
281outside, making it easy to add/remove tapes to/from the library. Those
282tapes are considered to be "offline", so backup jobs will not use
70d00e01 283them. Those special slots are auto-detected and marked as an
0912878e
DM
284``import-export`` slot in the status command.
285
286It's worth noting that some of the smaller tape libraries don't have
70d00e01
DW
287such slots. While they have something called a "Mail Slot", that slot
288is just a way to grab the tape from the gripper. They are unable
0912878e 289to hold media while the robot does other things. They also do not
5f3b2330 290expose that "Mail Slot" over the SCSI interface, so you won't see them in
0912878e
DM
291the status output.
292
293As a workaround, you can mark some of the normal slots as export
294slot. The software treats those slots like real ``import-export``
53939bb4 295slots, and the media inside those slots are considered to be 'offline'
98cdee78
DM
296(not available for backup):
297
298.. code-block:: console
0912878e
DM
299
300 # proxmox-tape changer update sl3 --export-slots 15,16
301
302After that, you can see those artificial ``import-export`` slots in
98cdee78
DM
303the status output:
304
305.. code-block:: console
0912878e 306
04eba29c 307 # proxmox-tape changer status sl3
0912878e
DM
308 ┌───────────────┬──────────┬────────────┬─────────────┐
309 │ entry-kind │ entry-id │ changer-id │ loaded-slot │
310 ╞═══════════════╪══════════╪════════════╪═════════════╡
311 │ drive │ 0 │ vtape1 │ 1 │
312 ├───────────────┼──────────┼────────────┼─────────────┤
313 │ import-export │ 15 │ │ │
314 ├───────────────┼──────────┼────────────┼─────────────┤
315 │ import-export │ 16 │ │ │
316 ├───────────────┼──────────┼────────────┼─────────────┤
317 │ slot │ 1 │ │ │
318 ├───────────────┼──────────┼────────────┼─────────────┤
319 │ slot │ 2 │ vtape2 │ │
320 ├───────────────┼──────────┼────────────┼─────────────┤
321 │ ... │ ... │ │ │
322 ├───────────────┼──────────┼────────────┼─────────────┤
323 │ slot │ 14 │ │ │
324 └───────────────┴──────────┴────────────┴─────────────┘
a174854a 325
225affc9 326.. _tape_drive_config:
baefbc44
DM
327
328Tape drives
329~~~~~~~~~~~
330
53939bb4
DW
331.. image:: images/screenshots/pbs-gui-tape-drives.png
332 :align: right
333 :alt: Tape Backup: Drive list
334
04eba29c 335Linux is able to auto detect tape drives, and you can get a list
98cdee78
DM
336of available tape drives using:
337
338.. code-block:: console
04eba29c
DM
339
340 # proxmox-tape drive scan
341 ┌────────────────────────────────┬────────┬─────────────┬────────┐
342 │ path │ vendor │ model │ serial │
343 ╞════════════════════════════════╪════════╪═════════════╪════════╡
ee9fa953 344 │ /dev/tape/by-id/scsi-12345-sg │ IBM │ ULT3580-TD4 │ 12345 │
04eba29c
DM
345 └────────────────────────────────┴────────┴─────────────┴────────┘
346
53939bb4
DW
347.. image:: images/screenshots/pbs-gui-tape-drives-add.png
348 :align: right
349 :alt: Tape Backup: Add a tape drive
350
04eba29c 351In order to use that drive with Proxmox, you need to create a
53939bb4
DW
352configuration entry. This can be done through **Tape Backup -> Drives** in the
353GUI or by using the command below:
98cdee78
DM
354
355.. code-block:: console
04eba29c 356
ee9fa953 357 # proxmox-tape drive create mydrive --path /dev/tape/by-id/scsi-12345-sg
04eba29c 358
70d00e01 359.. Note:: Please use the persistent device path names from inside
ee9fa953 360 ``/dev/tape/by-id/``. Names like ``/dev/sg0`` may point to a
04eba29c
DM
361 different device after reboot, and that is not what you want.
362
363If you have a tape library, you also need to set the associated
98cdee78
DM
364changer device:
365
366.. code-block:: console
04eba29c 367
627d0000 368 # proxmox-tape drive update mydrive --changer sl3 --changer-drivenum 0
04eba29c 369
627d0000 370The ``--changer-drivenum`` is only necessary if the tape library
70d00e01 371includes more than one drive (the changer status command lists all
02633961 372drive numbers).
04eba29c 373
70d00e01 374You can display the final configuration with:
98cdee78
DM
375
376.. code-block:: console
04eba29c
DM
377
378 # proxmox-tape drive config mydrive
379 ┌─────────┬────────────────────────────────┐
380 │ Name │ Value │
381 ╞═════════╪════════════════════════════════╡
382 │ name │ mydrive │
383 ├─────────┼────────────────────────────────┤
ee9fa953 384 │ path │ /dev/tape/by-id/scsi-12345-sg │
04eba29c
DM
385 ├─────────┼────────────────────────────────┤
386 │ changer │ sl3 │
387 └─────────┴────────────────────────────────┘
388
627d0000 389.. NOTE:: The ``changer-drivenum`` value 0 is not stored in the
70d00e01 390 configuration, because it is the default.
04eba29c 391
98cdee78
DM
392To list all configured drives use:
393
394.. code-block:: console
04eba29c
DM
395
396 # proxmox-tape drive list
397 ┌──────────┬────────────────────────────────┬─────────┬────────┬─────────────┬────────┐
398 │ name │ path │ changer │ vendor │ model │ serial │
399 ╞══════════╪════════════════════════════════╪═════════╪════════╪═════════════╪════════╡
ee9fa953 400 │ mydrive │ /dev/tape/by-id/scsi-12345-sg │ sl3 │ IBM │ ULT3580-TD4 │ 12345 │
04eba29c
DM
401 └──────────┴────────────────────────────────┴─────────┴────────┴─────────────┴────────┘
402
53939bb4 403The Vendor, Model and Serial number are auto detected and only shown
04eba29c
DM
404if the device is online.
405
98cdee78
DM
406For testing, you can simply query the drive status with:
407
408.. code-block:: console
632756b6
DM
409
410 # proxmox-tape status --drive mydrive
54311a38
DM
411 ┌────────────────┬──────────────────────────┐
412 │ Name │ Value │
413 ╞════════════════╪══════════════════════════╡
414 │ blocksize │ 0 │
415 ├────────────────┼──────────────────────────┤
416 │ density │ LTO4 │
417 ├────────────────┼──────────────────────────┤
418 │ compression │ 1 │
419 ├────────────────┼──────────────────────────┤
420 │ buffer-mode │ 1 │
421 ├────────────────┼──────────────────────────┤
422 │ alert-flags │ (empty) │
423 ├────────────────┼──────────────────────────┤
424 │ file-number │ 0 │
425 ├────────────────┼──────────────────────────┤
426 │ block-number │ 0 │
427 ├────────────────┼──────────────────────────┤
428 │ manufactured │ Fri Dec 13 01:00:00 2019 │
429 ├────────────────┼──────────────────────────┤
430 │ bytes-written │ 501.80 GiB │
431 ├────────────────┼──────────────────────────┤
432 │ bytes-read │ 4.00 MiB │
433 ├────────────────┼──────────────────────────┤
434 │ medium-passes │ 20 │
435 ├────────────────┼──────────────────────────┤
436 │ medium-wearout │ 0.12% │
437 ├────────────────┼──────────────────────────┤
438 │ volume-mounts │ 2 │
439 └────────────────┴──────────────────────────┘
632756b6
DM
440
441.. NOTE:: Blocksize should always be 0 (variable block size
70d00e01 442 mode). This is the default anyway.
632756b6 443
baefbc44 444
225affc9
DM
445.. _tape_media_pool_config:
446
baefbc44
DM
447Media Pools
448~~~~~~~~~~~
449
53939bb4
DW
450.. image:: images/screenshots/pbs-gui-tape-pools.png
451 :align: right
452 :alt: Tape Backup: Media Pools
453
08d8b2a4 454A media pool is a logical container for tapes. A backup job targets
53939bb4 455a single media pool, so a job only uses tapes from that pool.
08d8b2a4
DM
456
457.. topic:: Media Set
458
459 A media set is a group of continuously written tapes, used to split
460 the larger pool into smaller, restorable units. One or more backup
59217472 461 jobs write to a media set, producing an ordered group of
70d00e01
DW
462 tapes. Media sets are identified by a unique ID. That ID and the
463 sequence number are stored on each tape of that set (tape label).
08d8b2a4 464
70d00e01
DW
465 Media sets are the basic unit for restore tasks. This means that you need
466 every tape in the set to restore the media set contents. Data is fully
08d8b2a4
DM
467 deduplicated inside a media set.
468
469
470.. topic:: Media Set Allocation Policy
471
472 The pool additionally defines how long backup jobs can append data
59217472 473 to a media set. The following settings are possible:
08d8b2a4 474
b3bed7e4 475 - Try to use the current media set (``continue``).
08d8b2a4 476
70d00e01 477 This setting produces one large media set. While this is very
59217472 478 space efficient (deduplication, no unused space), it can lead to
70d00e01 479 long restore times, because restore jobs need to read all tapes in the
59217472 480 set.
08d8b2a4 481
70d00e01 482 .. NOTE:: Data is fully deduplicated inside a media set. This
59217472 483 also means that data is randomly distributed over the tapes in
70d00e01
DW
484 the set. Thus, even if you restore a single VM, data may have to be
485 read from all tapes inside the media set.
59217472 486
70d00e01
DW
487 Larger media sets are also more error-prone, because a single
488 damaged tape makes the restore fail.
59217472 489
70d00e01 490 Usage scenario: Mostly used with tape libraries. You manually
59217472
DM
491 trigger new set creation by running a backup job with the
492 ``--export`` option.
493
e84b801c 494 .. NOTE:: Retention period starts with the existence of a newer
02633961 495 media set.
e84b801c 496
b3bed7e4 497 - Always create a new media set (``always``).
59217472 498
70d00e01
DW
499 With this setting, each backup job creates a new media set. This
500 is less space efficient, because the media from the last set
59217472
DM
501 may not be fully written, leaving the remaining space unused.
502
b0427dda 503 The advantage is that this produces media sets of minimal
70d00e01
DW
504 size. Small sets are easier to handle, can be moved more conveniently
505 to an off-site vault, and can be restored much faster.
59217472 506
e84b801c
DM
507 .. NOTE:: Retention period starts with the creation time of the
508 media set.
509
59217472
DM
510 - Create a new set when the specified Calendar Event triggers.
511
512 .. _systemd.time manpage: https://manpages.debian.org/buster/systemd/systemd.time.7.en.html
513
514 This allows you to specify points in time by using systemd like
515 Calendar Event specifications (see `systemd.time manpage`_).
516
517 For example, the value ``weekly`` (or ``Mon *-*-* 00:00:00``)
518 will create a new set each week.
519
02633961 520 This balances between space efficiency and media count.
08d8b2a4 521
83b5076d
DC
522 .. NOTE:: Retention period starts on the creation time of the next
523 media-set or, if that does not exist, when the calendar event
6481fd24 524 next triggers after the current media-set start time.
e84b801c 525
08d8b2a4
DM
526 Additionally, the following events may allocate a new media set:
527
59217472 528 - Required tape is offline (and you use a tape library).
08d8b2a4 529
3f4a62de 530 - Current set contains damaged or retired tapes.
08d8b2a4 531
70d00e01 532 - Media pool encryption has changed
6dd05135 533
70d00e01
DW
534 - Database consistency errors, for example, if the inventory does not
535 contain the required media information, or it contains conflicting
536 information (outdated data).
08d8b2a4
DM
537
538.. topic:: Retention Policy
539
e84b801c 540 Defines how long we want to keep the data.
08d8b2a4 541
3838ce33
DM
542 - Always overwrite media.
543
544 - Protect data for the duration specified.
545
546 We use systemd like time spans to specify durations, e.g. ``2
547 weeks`` (see `systemd.time manpage`_).
548
549 - Never overwrite data.
08d8b2a4 550
794b0fe9
DM
551.. topic:: Hardware Encryption
552
70d00e01 553 LTO-4 (or later) tape drives support hardware encryption. If you
794b0fe9
DM
554 configure the media pool to use encryption, all data written to the
555 tapes is encrypted using the configured key.
556
70d00e01
DW
557 This way, unauthorized users cannot read data from the media,
558 for example, if you loose a tape while shipping to an offsite location.
794b0fe9 559
70d00e01 560 .. Note:: If the backup client also encrypts data, data on the tape
794b0fe9
DM
561 will be double encrypted.
562
70d00e01 563 The password protected key is stored on each medium, so that it is
ee9fa953 564 possbible to `restore the key <tape_restore_encryption_key_>`_ using
70d00e01
DW
565 the password. Please make sure to remember the password, in case
566 you need to restore the key.
794b0fe9 567
53939bb4
DW
568.. image:: images/screenshots/pbs-gui-tape-pools-add.png
569 :align: right
570 :alt: Tape Backup: Add a media pool
08d8b2a4 571
53939bb4
DW
572To create a new media pool, add one from **Tape Backup -> Media Pools** in the
573GUI, or enter the following command:
98cdee78
DM
574
575.. code-block:: console
0bce2118
DM
576
577 // proxmox-tape pool create <name> --drive <string> [OPTIONS]
578
579 # proxmox-tape pool create daily --drive mydrive
580
08d8b2a4 581
53939bb4 582Additional options can be set later, using the update command:
98cdee78
DM
583
584.. code-block:: console
08d8b2a4 585
0bce2118
DM
586 # proxmox-tape pool update daily --allocation daily --retention 7days
587
588
98cdee78
DM
589To list all configured pools use:
590
591.. code-block:: console
0bce2118
DM
592
593 # proxmox-tape pool list
594 ┌───────┬──────────┬────────────┬───────────┬──────────┐
595 │ name │ drive │ allocation │ retention │ template │
596 ╞═══════╪══════════╪════════════╪═══════════╪══════════╡
597 │ daily │ mydrive │ daily │ 7days │ │
598 └───────┴──────────┴────────────┴───────────┴──────────┘
08d8b2a4 599
225affc9 600.. _tape_backup_job_config:
baefbc44 601
9cf45049
DM
602Tape Backup Jobs
603~~~~~~~~~~~~~~~~
604
53939bb4
DW
605.. image:: images/screenshots/pbs-gui-tape-backup-jobs.png
606 :align: right
607 :alt: Tape Backup: Tape Backup Jobs
608
9cf45049 609To automate tape backup, you can configure tape backup jobs which
70d00e01
DW
610write datastore content to a media pool, based on a specific time schedule.
611The required settings are:
9cf45049
DM
612
613- ``store``: The datastore you want to backup
614
615- ``pool``: The media pool - only tape cartridges from that pool are
616 used.
617
618- ``drive``: The tape drive.
619
620- ``schedule``: Job schedule (see :ref:`calendar-event-scheduling`)
621
622For example, to configure a tape backup job for datastore ``vmstore1``
623use:
624
625.. code-block:: console
626
627 # proxmox-tape backup-job create job2 --store vmstore1 \
628 --pool yourpool --drive yourdrive --schedule daily
629
70d00e01 630The backup includes all snapshots from a backup group by default. You can
9cf45049
DM
631set the ``latest-only`` flag to include only the latest snapshots:
632
633.. code-block:: console
634
635 # proxmox-tape backup-job update job2 --latest-only
636
70d00e01 637Backup jobs can use email to send tape request notifications or
9cf45049
DM
638report errors. You can set the notification user with:
639
640.. code-block:: console
641
642 # proxmox-tape backup-job update job2 --notify-user root@pam
643
644.. Note:: The email address is a property of the user (see :ref:`user_mgmt`).
645
646It is sometimes useful to eject the tape from the drive after a
70d00e01 647backup. For a standalone drive, the ``eject-media`` option ejects the
9cf45049
DM
648tape, making sure that the following backup cannot use the tape
649(unless someone manually loads the tape again). For tape libraries,
650this option unloads the tape to a free slot, which provides better
651dust protection than inside a drive:
652
653.. code-block:: console
654
655 # proxmox-tape backup-job update job2 --eject-media
656
70d00e01 657.. Note:: For failed jobs, the tape remains in the drive.
9cf45049 658
70d00e01 659For tape libraries, the ``export-media`` option moves all tapes from
9cf45049 660the media set to an export slot, making sure that the following backup
70d00e01 661cannot use the tapes. An operator can pick up those tapes and move them
9cf45049
DM
662to a vault.
663
664.. code-block:: console
665
666 # proxmox-tape backup-job update job2 --export-media
667
668.. Note:: The ``export-media`` option can be used to force the start
669 of a new media set, because tapes from the current set are no
670 longer online.
671
672It is also possible to run backup jobs manually:
673
674.. code-block:: console
675
676 # proxmox-tape backup-job run job2
677
678To remove a job, please use:
679
680.. code-block:: console
681
682 # proxmox-tape backup-job remove job2
baefbc44 683
74391d1c 684By default, all (recursive) namespaces of the datastore are included in a tape
e87e4499 685backup. You can specify a single namespace with ``ns`` and a depth with
74391d1c
DC
686``max-depth``. For example:
687
688.. code-block:: console
689
690 # proxmox-tape backup-job update job2 --ns mynamespace --max-depth 3
691
692If no `max-depth` is given, it will include all recursive namespaces.
693
53939bb4
DW
694.. image:: images/screenshots/pbs-gui-tape-backup-jobs-add.png
695 :align: right
696 :alt: Tape Backup: Add a backup job
697
698This same functionality also exists in the GUI, under the **Backup Jobs** tab of
699**Tape Backup**, where *Local Datastore* relates to the datastore you want to
700backup and *Media Pool* is the pool to back up to.
701
baefbc44
DM
702
703Administration
704--------------
705
70d00e01 706Many sub-commands of the ``proxmox-tape`` command line tools take a
44ce25e7 707parameter called ``--drive``, which specifies the tape drive you want
70d00e01 708to work on. For convenience, you can set this in an environment
98cdee78
DM
709variable:
710
711.. code-block:: console
44ce25e7
DM
712
713 # export PROXMOX_TAPE_DRIVE=mydrive
714
715You can then omit the ``--drive`` parameter from the command. If the
716drive has an associated changer device, you may also omit the changer
53939bb4 717parameter from commands that need a changer device, for example:
98cdee78
DM
718
719.. code-block:: console
44ce25e7
DM
720
721 # proxmox-tape changer status
722
70d00e01 723should display the changer status of the changer device associated with
44ce25e7
DM
724drive ``mydrive``.
725
726
baefbc44
DM
727Label Tapes
728~~~~~~~~~~~
729
70d00e01
DW
730By default, tape cartridges all look the same, so you need to put a
731label on them for unique identification. First, put a sticky paper
8001c82e
DM
732label with some human readable text on the cartridge.
733
734If you use a `Tape Library`_, you should use an 8 character string
70d00e01
DW
735encoded as `Code 39`_, as defined in the `LTO Ultrium Cartridge Label
736Specification`_. You can either buy such barcode labels from your
737cartridge vendor, or print them yourself. You can use our `LTO Barcode
738Generator`_ app to print them.
8001c82e
DM
739
740Next, you need to write that same label text to the tape, so that the
741software can uniquely identify the tape too.
742
70d00e01 743For a standalone drive, manually insert the new tape cartridge into the
98cdee78
DM
744drive and run:
745
746.. code-block:: console
8001c82e 747
0bce2118
DM
748 # proxmox-tape label --changer-id <label-text> [--pool <pool-name>]
749
750You may omit the ``--pool`` argument to allow the tape to be used by any pool.
8001c82e 751
70d00e01 752.. Note:: For safety reasons, this command fails if the tape contains
02633961 753 any data. If you want to overwrite it anyway, erase the tape first.
8001c82e 754
98cdee78
DM
755You can verify success by reading back the label:
756
757.. code-block:: console
8001c82e 758
0bce2118
DM
759 # proxmox-tape read-label
760 ┌─────────────────┬──────────────────────────────────────┐
761 │ Name │ Value │
762 ╞═════════════════╪══════════════════════════════════════╡
763 │ changer-id │ vtape1 │
764 ├─────────────────┼──────────────────────────────────────┤
765 │ uuid │ 7f42c4dd-9626-4d89-9f2b-c7bc6da7d533 │
766 ├─────────────────┼──────────────────────────────────────┤
767 │ ctime │ Wed Jan 6 09:07:51 2021 │
768 ├─────────────────┼──────────────────────────────────────┤
769 │ pool │ daily │
770 ├─────────────────┼──────────────────────────────────────┤
771 │ media-set-uuid │ 00000000-0000-0000-0000-000000000000 │
772 ├─────────────────┼──────────────────────────────────────┤
773 │ media-set-ctime │ Wed Jan 6 09:07:51 2021 │
774 └─────────────────┴──────────────────────────────────────┘
775
776.. NOTE:: The ``media-set-uuid`` using all zeros indicates an empty
777 tape (not used by any media set).
8001c82e
DM
778
779If you have a tape library, apply the sticky barcode label to the tape
780cartridges first. Then load those empty tapes into the library. You
98cdee78
DM
781can then label all unlabeled tapes with a single command:
782
783.. code-block:: console
8001c82e 784
0bce2118 785 # proxmox-tape barcode-label [--pool <pool-name>]
8001c82e
DM
786
787
baefbc44
DM
788Run Tape Backups
789~~~~~~~~~~~~~~~~
790
53939bb4 791To manually run a backup job click *Run Now* in the GUI or use the command:
98cdee78
DM
792
793.. code-block:: console
9738dd54
DM
794
795 # proxmox-tape backup <store> <pool> [OPTIONS]
796
797The following options are available:
798
799--eject-media Eject media upon job completion.
800
801 It is normally good practice to eject the tape after use. This unmounts the
70d00e01 802 tape from the drive and prevents the tape from getting dusty.
9738dd54
DM
803
804--export-media-set Export media set upon job completion.
805
02633961 806 After a successful backup job, this moves all tapes from the used
9738dd54
DM
807 media set into import-export slots. The operator can then pick up
808 those tapes and move them to a media vault.
809
74391d1c
DC
810--ns The namespace to backup.
811
6481fd24
DW
812 Used if you only want to backup a specific namespace. If omitted, the root
813 namespace is assumed.
74391d1c
DC
814
815--max-depth The depth to recurse namespaces.
816
817 ``0`` means no recursion at all (only the given namespace). If omitted,
6481fd24 818 all namespaces are recursed (below the given one).
74391d1c 819
9738dd54 820
baefbc44
DM
821Restore from Tape
822~~~~~~~~~~~~~~~~~
823
4cfb1234
DM
824Restore is done at media-set granularity, so you first need to find
825out which media set contains the data you want to restore. This
826information is stored in the media catalog. If you do not have media
827catalogs, you need to restore them first. Please note that you need
828the catalog to find your data, but restoring a complete media-set does
829not need media catalogs.
830
70d00e01 831The following command lists the media content (from catalog):
98cdee78
DM
832
833.. code-block:: console
4cfb1234
DM
834
835 # proxmox-tape media content
836 ┌────────────┬──────┬──────────────────────────┬────────┬────────────────────────────────┬──────────────────────────────────────┐
837 │ label-text │ pool │ media-set-name │ seq-nr │ snapshot │ media-set-uuid │
838 ╞════════════╪══════╪══════════════════════════╪════════╪════════════════════════════════╪══════════════════════════════════════╡
839 │ TEST01L8 │ p2 │ Wed Jan 13 13:55:55 2021 │ 0 │ vm/201/2021-01-11T10:43:48Z │ 9da37a55-aac7-4deb-91c6-482b3b675f30 │
840 ├────────────┼──────┼──────────────────────────┼────────┼────────────────────────────────┼──────────────────────────────────────┤
841 │ ... │ ... │ ... │ ... │ ... │ ... │
842 └────────────┴──────┴──────────────────────────┴────────┴────────────────────────────────┴──────────────────────────────────────┘
843
844
845A restore job reads the data from the media set and moves it back to
98cdee78
DM
846data disk (datastore):
847
848.. code-block:: console
4cfb1234
DM
849
850 // proxmox-tape restore <media-set-uuid> <datastore>
851
852 # proxmox-tape restore 9da37a55-aac7-4deb-91c6-482b3b675f30 mystore
853
fca84a4b
DC
854Single Snapshot Restore
855^^^^^^^^^^^^^^^^^^^^^^^
856
6481fd24
DW
857Sometimes it is not necessary to restore an entire media-set, but only some
858specific snapshots from the tape. This can be achieved with the ``snapshots``
fca84a4b
DC
859parameter:
860
861
862.. code-block:: console
863
864 // proxmox-tape restore <media-set-uuid> <datastore> [<snapshot>]
865
866 # proxmox-tape restore 9da37a55-aac7-4deb-91c6-482b3b675f30 mystore sourcestore:host/hostname/2022-01-01T00:01:00Z
867
868This first restores the snapshot to a temporary location, then restores the relevant
869chunk archives, and finally restores the snapshot data to the target datastore.
870
6481fd24 871The ``snapshot`` parameter can be passed multiple times, in order to restore
fca84a4b
DC
872multiple snapshots with one restore action.
873
874.. NOTE:: When using the single snapshot restore, the tape must be traversed
875 more than once, which, if you restore many snapshots at once, can take longer
876 than restoring the whole datastore.
4cfb1234 877
74391d1c
DC
878Namespaces
879^^^^^^^^^^
880
881It is also possible to select and map specific namespaces from a media-set
882during a restore. This is possible with the ``namespaces`` parameter.
6481fd24 883The format for the parameter is:
74391d1c
DC
884
885.. code-block:: console
886
887 store=<source-datastore>[,source=<source-ns>][,target=<target-ns>][,max-depth=<depth>]
888
889If ``source`` or ``target`` is not given, the root namespace is assumed.
890When no ``max-depth`` is given, the source namespace will be fully recursed.
891
892An example restore command:
893
894.. code-block:: console
895
896 # proxmox-tape restore 9da37a55-aac7-4deb-91c6-482b3b675f30 mystore --namespaces store=sourcedatastore,source=ns1,target=ns2,max-depth=2
897
898The parameter can be given multiple times. It can also be combined with the
899``snapshots`` parameter to only restore those snapshots and map them to different
900namespaces.
901
baefbc44
DM
902Update Inventory
903~~~~~~~~~~~~~~~~
904
4cfb1234 905
baefbc44
DM
906Restore Catalog
907~~~~~~~~~~~~~~~
9738dd54 908
a5f30a56
DC
909To restore a catalog from an existing tape, just insert the tape into the drive
910and execute:
911
912.. code-block:: console
913
914 # proxmox-tape catalog
915
916
917You can restore from a tape even without an existing catalog, but only the
918whole media set. If you do this, the catalog will be automatically created.
919
4cfb1234 920
794b0fe9
DM
921Encryption Key Management
922~~~~~~~~~~~~~~~~~~~~~~~~~
923
53939bb4
DW
924.. image:: images/screenshots/pbs-gui-tape-crypt-keys.png
925 :align: right
926 :alt: Tape Backup: Encryption Keys
927
928Proxmox Backup Server also provides an interface for handling encryption keys on
929the backup server. Encryption keys can be managed from the **Tape Backup ->
930Encryption Keys** section of the GUI or through the ``proxmox-tape key`` command
931line tool. To create a new encryption key from the command line:
98cdee78
DM
932
933.. code-block:: console
794b0fe9
DM
934
935 # proxmox-tape key create --hint "tape pw 2020"
936 Tape Encryption Key Password: **********
937 Verify Password: **********
938 "14:f8:79:b9:f5:13:e5:dc:bf:b6:f9:88:48:51:81:dc:79:bf:a0:22:68:47:d1:73:35:2d:b6:20:e1:7f:f5:0f"
939
98cdee78
DM
940List existing encryption keys:
941
942.. code-block:: console
794b0fe9
DM
943
944 # proxmox-tape key list
945 ┌───────────────────────────────────────────────────┬───────────────┐
946 │ fingerprint │ hint │
947 ╞═══════════════════════════════════════════════════╪═══════════════╡
948 │ 14:f8:79:b9:f5:13:e5:dc: ... :b6:20:e1:7f:f5:0f │ tape pw 2020 │
949 └───────────────────────────────────────────────────┴───────────────┘
950
98cdee78
DM
951To show encryption key details:
952
953.. code-block:: console
794b0fe9
DM
954
955 # proxmox-tape key show 14:f8:79:b9:f5:13:e5:dc:...:b6:20:e1:7f:f5:0f
956 ┌─────────────┬───────────────────────────────────────────────┐
957 │ Name │ Value │
958 ╞═════════════╪═══════════════════════════════════════════════╡
959 │ kdf │ scrypt │
960 ├─────────────┼───────────────────────────────────────────────┤
961 │ created │ Sat Jan 23 14:47:21 2021 │
962 ├─────────────┼───────────────────────────────────────────────┤
963 │ modified │ Sat Jan 23 14:47:21 2021 │
964 ├─────────────┼───────────────────────────────────────────────┤
965 │ fingerprint │ 14:f8:79:b9:f5:13:e5:dc:...:b6:20:e1:7f:f5:0f │
966 ├─────────────┼───────────────────────────────────────────────┤
967 │ hint │ tape pw 2020 │
968 └─────────────┴───────────────────────────────────────────────┘
969
8ba47929
DM
970The ``paperkey`` subcommand can be used to create a QR encoded
971version of a tape encryption key. The following command sends the output of the
98cdee78
DM
972``paperkey`` command to a text file, for easy printing:
973
974.. code-block:: console
8ba47929
DM
975
976 proxmox-tape key paperkey <fingerprint> --output-format text > qrkey.txt
977
978
225affc9 979.. _tape_restore_encryption_key:
794b0fe9
DM
980
981Restoring Encryption Keys
982^^^^^^^^^^^^^^^^^^^^^^^^^
983
984You can restore the encryption key from the tape, using the password
985used to generate the key. First, load the tape you want to restore
98cdee78
DM
986into the drive. Then run:
987
988.. code-block:: console
794b0fe9
DM
989
990 # proxmox-tape key restore
991 Tepe Encryption Key Password: ***********
992
993If the password is correct, the key will get imported to the
02633961 994database. Further restore jobs automatically use any available key.
794b0fe9 995
4cfb1234 996
9738dd54
DM
997Tape Cleaning
998~~~~~~~~~~~~~
999
70d00e01 1000LTO tape drives require regular cleaning. This is done by loading a
9738dd54
DM
1001cleaning cartridge into the drive, which is a manual task for
1002standalone drives.
1003
1004For tape libraries, cleaning cartridges are identified using special
1005labels starting with letters "CLN". For example, our tape library has a
98cdee78
DM
1006cleaning cartridge inside slot 3:
1007
1008.. code-block:: console
9738dd54
DM
1009
1010 # proxmox-tape changer status sl3
1011 ┌───────────────┬──────────┬────────────┬─────────────┐
1012 │ entry-kind │ entry-id │ changer-id │ loaded-slot │
1013 ╞═══════════════╪══════════╪════════════╪═════════════╡
1014 │ drive │ 0 │ vtape1 │ 1 │
1015 ├───────────────┼──────────┼────────────┼─────────────┤
1016 │ slot │ 1 │ │ │
1017 ├───────────────┼──────────┼────────────┼─────────────┤
1018 │ slot │ 2 │ vtape2 │ │
1019 ├───────────────┼──────────┼────────────┼─────────────┤
1020 │ slot │ 3 │ CLN001CU │ │
1021 ├───────────────┼──────────┼────────────┼─────────────┤
1022 │ ... │ ... │ │ │
1023 └───────────────┴──────────┴────────────┴─────────────┘
1024
98cdee78
DM
1025To initiate a cleaning operation simply run:
1026
1027.. code-block:: console
9738dd54
DM
1028
1029 # proxmox-tape clean
1030
1031This command does the following:
1032
1033- find the cleaning tape (in slot 3)
1034
70d00e01 1035- unload the current media from the drive (back to slot 1)
9738dd54
DM
1036
1037- load the cleaning tape into the drive
1038
1039- run drive cleaning operation
1040
1041- unload the cleaning tape (to slot 3)
9c96e536
DC
1042
1043Example Setups
1044--------------
1045
6481fd24 1046Here are a few example setups for managing media pools and schedules.
9c96e536
DC
1047This is not an exhaustive list, and there are many more possible combinations
1048of useful settings.
1049
bd030091
DC
1050Single Continued Media Set
1051~~~~~~~~~~~~~~~~~~~~~~~~~~
9c96e536 1052
bd030091 1053The most simple setup: always continue the media-set and never expire.
9c96e536
DC
1054
1055Allocation policy:
1056 continue
1057
1058Retention policy:
1059 keep
1060
6481fd24
DW
1061This setup has the advantage of being easy to manage and reuses the benefits
1062from deduplication as much as possible. But, it also provides no redundancy,
1063meaning a failure of any single tape would render all backups referring to
1064chunks from that tape unusable.
bd030091
DC
1065
1066If you want to start a new media-set manually, you can set the currently
1067writable media of the set either to 'full', or set the location to an
6481fd24 1068off-site vault.
9c96e536
DC
1069
1070Weekday Scheme
1071~~~~~~~~~~~~~~
1072
bd030091
DC
1073A slightly more complex scheme, where the goal is to have an independent
1074tape or media set for each weekday, for example from Monday to Friday.
1075This can be solved by having a separate media pool for each day, so 'Monday',
1076'Tuesday', etc.
9c96e536
DC
1077
1078Allocation policy:
1079 should be 'mon' for the 'Monday' pool, 'tue' for the Tuesday pool and so on.
1080
1081Retention policy:
1082 overwrite
1083
6481fd24 1084There should be one or more tape-backup jobs for each pool on the corresponding
bd030091 1085weekday. This scheme is still very manageable with one media set per weekday,
6481fd24 1086and could be moved off-site easily.
9c96e536 1087
eb080f36 1088Multiple Pools with Different Policies
bd030091 1089~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9c96e536 1090
6481fd24 1091Complex setups are also possible, with multiple media pools configured with
9c96e536
DC
1092different allocation and retention policies.
1093
eb080f36
TL
1094An example would be to have two media pools. The first configured with weekly
1095allocation and a few weeks of retention:
9c96e536
DC
1096
1097Allocation policy:
1098 mon
1099
1100Retention policy:
1101 3 weeks
1102
6481fd24 1103The second pool configured with yearly allocation that does not expire:
9c96e536
DC
1104
1105Allocation policy:
1106 yearly
1107
1108Retention policy:
1109 keep
1110
6481fd24
DW
1111In combination with fitting prune settings and tape backup schedules, this
1112achieves long-term storage of some backups, while keeping the recent
1113backups on smaller media sets that expire roughly every 4 weeks (that is, three
1114plus the current week).