Create Bacula tape storage#

To store Bacula backups, you need to configure a Bacula storage.

Tape storage is one such destination, and this section will guide you through the process of setting up a tape autochanger with Bacula.

What is required?#

  • Bacularis version 4.4.0 or newer.

  • A tape autochanger device for storing backups

  • Bacula Storage Daemon installed on the host where the tape autochanger is connected

  • If the Storage Daemon and autochanger are on a remote host (from the perspective of the web interface), the Bacularis API must be installed and configured on that remote host

How to do it?#

Preparation#

To begin, you need to identify the device names of the tape drives and the changer in your system. These are usually located in /dev/, such as:

  • Tape drives, for example: /dev/nst0, /dev/nst12, etc.

  • Changer device, for example: /dev/sg4, /dev/sg21, etc.

You can use the lsscsi -g command to list these devices:

# lsscsi -g
[1:0:0:0]    disk    ATA      WDC  WDS100T1R0A 00WR  /dev/sda   /dev/sg0
[2:0:0:0]    disk    ATA      SSDPR-CX300-120  11.2  /dev/sdb   /dev/sg1
[3:0:0:0]    disk    ATA      WDC  WDS500G1R0A 10WR  /dev/sdc   /dev/sg2
[4:0:0:0]    disk    ATA      WDC  WDS100T1R0A 00WR  /dev/sdd   /dev/sg3
[7:0:0:0]    mediumx STK      L700             0107  /dev/sch2  /dev/sg6
[7:0:1:0]    tape    IBM      ULT3580-TD5      0107  /dev/st1   /dev/sg8
[7:0:2:0]    tape    IBM      ULT3580-TD5      0107  /dev/st0   /dev/sg7
[7:0:3:0]    tape    IBM      ULT3580-TD4      0107  /dev/st4   /dev/sg12
[7:0:4:0]    tape    IBM      ULT3580-TD4      0107  /dev/st12  /dev/sg20

On the listing above we can see one autochanger L700 with the device name /dev/sg6.

Note

To access autochanger devices Bacula uses SCSI generic device names (/dev/sgX), not SCSI changer device names (/dev/schX).

On the listing are also four tape drives:

  • two ULT3580-TD4 with devices /dev/nst4 and /dev/nst12

  • two ULT3580-TD5 with devices /dev/nst1 and /dev/nst0

Note

Bacula accesses tape drives via non-rewinding device files, such as /dev/nst4, rather than /dev/st4. The “n” letter in the device name indicates “non-rewind”.

In modern operating systems the devices can be accessible via the symbolic links created by the UDEV system device manager. For tape devices, these links can be found under /dev/tape/by-id/.

For example:

  • /dev/tape/by-id/scsi-XYZZY_C4-nst/dev/nst19

  • /dev/tape/by-id/scsi-SSTK_L700_XYZZY_C-changer/dev/sg4

As you can easily notice the symbolic link names are the tape device unique hardware indentifiers and they are bound to the st or sg devices.

Using these persistent paths is recommended because they do not change even if the numeric device file names (nstX, sgX) do.

For Bacula it does not matter if you use the device files like /dev/sg or /dev/nst or you use links from /dev/tape/by-id/. Both definitions are valid, the /dev/tape/by-id/ is just a good practice that is the device number change resistant.

Once you’ve identified the correct devices, you’re ready to start configuration.

In the Bacularis web interface:

  • Open the Storage page from the Bacularis main menu

  • Click Add tape storage to launch the tape storage creation wizard

Step 1 - General#

In the Storage Daemon API host field, select the host where the Bacula Storage Daemon and tape autochanger are installed.

For the question Do you already have tape storage configured in Bacula?, select No.

Enter a name for your new storage and optionally add a description.

For What storage type would you like to create?, choose:

Single-drive or multi-drive tape storage with changer (autochanger)

Step 2 - Storage#

On the question What changer does your tape device have? you need to define two fields:

Under What changer does your tape device have?, fill in the following:

  • Changer device file - provide the path to the changer device or its symbolic link (e.g. /dev/sg6 or /dev/tape/by-id/...-changer)

  • Changer command - this is the command Bacula uses to manage the changer (load/unload tapes, list slots, etc.). Bacula includes a suitable script called mtx-changer to manage SCSI changers.

    • On DEB-based systems with Bacula installed from the system repositories, the script is located at: /etc/bacula/scripts/mtx-changer

    • On RPM-based systems with Bacula installed from the system repositories, the path is: /usr/libexec/bacula/mtx-changer

Define the Changer command field the mtx-changer script with full path and the following parameters:

For DEB-based systems:

/etc/bacula/scripts/mtx-changer %c %o %S %a %d

For RPM-based systems:

/usr/libexec/bacula/mtx-changer %c %o %S %a %d

Then, under the question What tape drives does your tape device have?, define all tape drive device names.

For What is the storage media type?, enter desired media type. This can be any string that in case tape storage, it can be characteristic for your tape type (or the tape generation), for example: MyLTO6Tape, TapeL8, BlueTape …etc.

Step 3 - Summary#

Review the configuration summary. If everything looks good, finish the wizard.

At the end, you’ll be prompted to allow Bacularis to restart the Bacula Storage Daemon.

Important notes#

If you choose not to allow Bacularis to restart the Storage Daemon during the wizard, the configuration will be created but won’t take effect until the daemon is restarted manually.

You can restart the Storage Daemon later by going to:

[Main menu] => [Page: Storage] => [Select storage in table] => [Button: Details]

Video guide#

Watch the step-by-step video tutorial for setting up tape storage using the Bacularis wizard: