Home > Backup and Recovery Strategies Blog > How to Execute Tape Backup with Bacula Enterprise Edition? Tape Backup and Recovery Guide.
1 Star2 Stars3 Stars4 Stars5 Stars
(27 votes, average: 5.00 out of 5)
Loading...

How to Execute Tape Backup with Bacula Enterprise Edition? Tape Backup and Recovery Guide.

  • February 15, 2019, Rob Morrison

tape backup and recovery in bacula enterpriseDespite the inroads made in large scale disk backup and backup to cloud strategies, magnetic tape backup and recovery remains a major component of many data protection architectures. Tape provides advantages that are hard to replace with any other technology. Factors such as data write speed, portability, reliability, ease of storage, and data density all contribute to the ongoing popularity of tapes. Bacula Enterprise Edition supports tape libraries of all vendors, sizes, and types, in addition to cloud and disk backup, giving the customer total flexibility in storage media. This how-to will describe some of the basic setup steps and configuration notes for using tape backup and recovery for most libraries with Bacula Enterprise Edition.

But first there’s a topic worth exploring: the reasons for choosing tape over other storage types, such as disks. Next we’ll go over some major advantages and challenges of both disks and tapes.

Disks are a well known storage medium, requiring little to no maintenance and their scalability is quite good in general. One of their main advantages is recovery time – allowing for easier access to specific files from your backup. There’s also all the advantages of deduplication, which is essentially the deletion of all duplicated data at an extremely granular level, so your backups typically take much less storage space.

However, there are some limitations when it comes to using disk as data storage. For example, a data that is kept on disks may be more susceptible to accidental overwrite or deletion, and can become a target of specific computer viruses. Disks can also be relatively costly when it comes to upkeep, since they’re always “working” and can become overheated, which means you’ll need both a means of cooling and providing power for the whole system to work properly. At the same time some people might think that relying on cloud backups would solve those problems – but cloud storages quite often use literally the same disk types as everyone else - merely providing you with access to them. This means most of these issues remain.

Then there’s tape, which is relatively old as a storage in means, but is still certainly reliable enough to be considered as a proper storage alternative. One of the biggest advantages of tape is its capacity – LTO-8 standard allows for up to 30 TB data per single tape unit (and future standard LTO-12 promises to reach the overall capacity of up to 480 TB per tape).

Price is a key point, as well. Tape is considered one of the cheapest storage choices there is when it comes to long-term data storage. It is used in some cloud services, too, and the offsite vaulting of tape in general allows the data to escape ramifications of a natural disaster or some other type of occurrence that might harm your data on-site.

Proper upkeep conditions will allow tape to stay sound for a long time with no damage to the data in question. The general tape lifespan is considered to be around 30 years. There’s also the nature of tape backups – they aren’t “plugged in”, as soon as the backup is done – the device itself goes offline, and that saves the data within from potential cyberattacks and such.

Unfortunately, tape isn’t perfect, either – it requires specific conditions to prevent data deterioration, general recovery times are much longer than most of the alternatives due to the need to physically get the tape in question to your working environment, and navigation within that data has more limitations than disk. Even with the most recent developments, such as linear tape file systems (LTFS) – it’s still nowhere close to that of disk searching speed.

Despite its limitations, tape is still considered to be one of the most convenient storage types when it comes to long-term data storage – and in that regard, tape prevails over most of the alternatives.

The Bacula Enterprise Storage Daemon is the component that manages reads and writes to the various storage devices supported by Bacula. Tape backup is managed in part by native Linux tools and therefore supported devices largely follow support in the Linux kernel. For information about whether or not a specific tape library or drive is supported by Bacula Enterprise Edition, Bacula Systems support can answer the question. However, most commercially available tape libraries and drives that are supported by the Linux kernel are supported by Bacula.

There are some common misconceptions about tape. We’ll walk some of the most popular ones:

Tape backup is dead. The only thing that’s dead about tape as a backup medium is the marketing efforts! A lot of companies still use tape in their backup systems. The lack of general understanding of the technology behind tape as a storage type prevents people from realizing the possible benefits of using tape as a backup storage medium. Partial blame for that can be laid upon tape vendors, they do little to educate against negative rumors and misconceptions.

Tape as a storage medium can be replaced. There are specific tape benefits that often, no other storage type can match as easily. High capacity is one of those, keeping large amounts of data on tape is considerably cheaper than using any other medium. For compliance purposes a lot of companies prefer tape over cloud to store their data intact and offsite at the same time. And tape’s offline capabilities allow it to naturally evade most of the cyberthreats of the modern age. They also require less power and generate less heat than other storage types like disks.

Tape is ineffective as a storage. It’s true that tape has its limitations, but it’s perfect for offsite data storage purposes and plays its part in long term data retention really well. There’s a well known strategy about backups, it’s called 3-2-1 rule: this where  you should keep three different copies of your data stored within at least two different types of storage and at least one copy must be kept off site – and tape backups are a perfect medium for playing part in that strategy, since its storage capabilities are huge, and when used as an offline storage, make it almost impenetrable by modern  cyber threats.

Tape as a data storage technology is old and outdated. It’s worth remembering that tape is basically the only storage medium that has been stable since it was created, with much less rises or declines in popularity, like disk or cloud storage experiences.

There is no future for tape backups. Due to tape’s reputation as a “dead” storage type, a lot of people think that it’s not evolving and has no future in general. This is not true; over 80% of modern companies of different sizes use tape backup as one of their means of storing data. More than that, recent years show the increase in this technology in general, and tape manufacturers are doing their best to improve tape as a storage medium in general, including not only capacity, but also data encryption within tape, data partition to lessen the overall backup complexity, and other optimization technologies.

Some people may be questioning the reasons to use tape in general, when it seems many are moving away from physical storage to the cloud. There are several reasons for that:

  • Durability – as mentioned before, with proper care tape is able to store data for about 30 years, which is a significant amount of time in general, and all of that without any regular maintenance. This puts most of the HDDs, SSDs and other storage mediums in shame in comparison.
  • Security – modern tape formats like LTO-Ultrium offer data encryption over tape to ensure compliance with all kinds of laws and standards when it comes to data security. Knowing where your tape backup is physically stored is also considered to be a major advantage when it comes to the requirement of physical control over a company's data.
  • Portability – despite its capacity in general, tape is generally quite easy to store, especially when compared to cloud systems or hard drives of any kind.
  • Conversion prices – some older companies don’t have the required funds to perform the migration to some other data storage medium or to include another one alongside tape. Full data storage conversions generally require an incredible amount of both work and funding, add to that all of the work about changes in policy – and it’ll be a good enough reason for companies to continue using tape despite everything.
  • Compliance – some organizations find it easier to use tape as a way to meet compliance laws and obligations, for example some banks and legal institutions.

While most tape backup and recovery drives will work with very little configuration, there are some main things to be aware of in order to have the best possible performance and reliability. Bacula Enterprise has a web interface, BWeb, which greatly simplifies setup and provides sensible defaults, it’s good to have an understanding of what is going on underneath in the configuration files. To get an idea of how BWeb manages creation and configuration of autochangers, please watch the video here: https://www.youtube.com/watch?v=_HZ-lnt4vg0 . This video is related to installing a deduplicating disk autochanger, but the same wizard and process are used to install tape devices. The information that follows should help fill in any gaps when setting up a tape autochanger, or allow you to set up tape autochangers without the help of BWeb.

By default, Bacula Enterprise is installed with a number of functional example configurations. There’s a tape autochanger (Bacula uses the word autochanger to describe the tape library) example that should look something like the one below.


# An autochanger device with two drives
#
#Autochanger {
# Name = Autochanger
# Device = Drive-1
# Device = Drive-2
# Changer Command = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d"
# Changer Device = /dev/sg0
#}

#Device {
# Name = Drive-1 #
# Drive Index = 0
# Media Type = DLT-8000
# Archive Device = /dev/nst0
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# AutoChanger = yes
# #
# # New alert command in Bacula Enterprise Edition 8.8.0
# # Note: you must have the sg3_utils (rpms) or the
# # sg3-utils (deb) installed on your system.
# # and you must set the correct control device that
# # corresponds to the Archive Device
# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0
# Alert Command = "/opt/bacula/scripts/tapealert %l"
#
# #
# # Enable the Alert command only if you have the mtx package loaded
# # Note, apparently on some systems, tapeinfo resets the SCSI controller
# # thus if you turn this on, make sure it does not reset your SCSI
# # controller. I have never had any problems, and smartctl does
# # not seem to cause such problems.
# #
# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
# If you have smartctl, enable this, it has more info than tapeinfo
# Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#Device {
# Name = Drive-2 #
# Drive Index = 1
# Media Type = DLT-8000
# Archive Device = /dev/nst1
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# AutoChanger = yes
# # Enable the Alert command only if you have the mtx package loaded
# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
# If you have smartctl, enable this, it has more info than tapeinfo
# Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

Let’s break this down a bit. To make a better configuration, we’d need to make just a few changes. First, it should have a better name to avoid confusion in the future. The device names here can change to match as well, as they are just references to the device resources we’ll look at next. Next, it’s best to use the udev device name rather than the ‘/dev/sgX’ device path, as the udev name will never change on a reboot. So that will look like ‘/dev/tape/by-id/scsi-xxxxxxxxxxxx’ The changer command usually doesn’t need to change, and you can view the script in ‘/opt/bacula/scripts/’ if you want to see how it works. So the example below is closer to a production config:


# An autochanger device with two drives
#
#Autochanger {
# Name = HPLTOLib1
# Device = HPLTOLib1-Drive-1
# Device = HPLTOLib1-Drive-2
# Changer Command = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d"
# Changer Device = /dev/tape/by-id/scsi-xxxxxxxxxxxx
#}

Next, let’s look at the tape devices. As with the autochanger itself, we’ll want to rename the devices so it’s clear which device ‘owns’ them. In this case, the names must match the names in the autochanger config. We’ll also want to use the udev persistent names, as you can see below. The drive index is important; when mtx-changer issues a command such as ‘load tape x into drive y’, it uses the drive index from this device setting to determine where the tape will go. So this must match what the library itself understands the drive numbering to be. Usually it starts with drive 0.

The Media Type is an arbitrary designation given to devices within a tape library to tell Bacula which devices can be called to operate which tapes. Tapes are labeled with a media type as well. This means that, for example, if you have two LTO-7 tape drives in library A, and two in Library B, it may be best to give them different media types so that Bacula doesn’t request a mount from Library A to Library B. So in this case, we’ll the the media type to the autochanger.

Always Open means that Bacula will not rewind the tape after each write session, but rather leave the drive ready for the next append. Automatic Mount means what it sounds like; Bacula will mount and use the tape devices without user intervention. Removable Media tells Bacula that the media may not always be available in the autochanger and changes the behavior when a new tape is needed. Random Access is set to ‘no’ as tapes are read and written in a linear manner, and finally Bacula needs to know that the device is a member of an autochanger. Bacula Enterprise can also use the sg3-utils packages to send tape alert and monitoring commands, and alert you if a drive is showing errors. So the config below is pretty good, and can be copied for the second drive with just a change to the name, drive index, and archive device.


#Device {
# Name = HPLTOLib1-Drive-1 #
# Drive Index = 0
# Media Type = HPLTOLib1-LTO-7
# Archive Device = /dev/tape/by-id/scsi-xxxxxxx-nst
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# AutoChanger = yes
# Maximum Block Size = xxxxxxxx
# Maximum File Size = xxx
# #
# # New alert command in Bacula Enterprise Edition 8.8.0
# # Note: you must have the sg3_utils (rpms) or the
# # sg3-utils (deb) installed on your system.
# # and you must set the correct control device that
# # corresponds to the Archive Device
# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0
# Alert Command = "/opt/bacula/scripts/tapealert %l"
#

So with the above, we could very likely have a working configuration that can load, unload, read, and write volumes. What are the next steps? First, there is a command line tool called ‘btape’ that should be run before putting anything into production. Please note that btape will destroy any data on a volume, so please use a blank tape! Within btape, there are commands to test the autochanger, test writing a full tape and making sure it can be read back, as well as performance testing tools. A successful run of the ‘btape test’ for each device, and ‘btape autochanger’ should be considered a minimum requirement.

Finally, for performance, the ‘maximum block size’ and ‘maximum file size’ should be set for each device. The values here that will yield the best performance depend mostly on the tape drive technology. Sensible defaults are set by BWeb, or can be provided by Bacula Systems Support. Block sizes usually range between 64-512k, and file size anywhere from 1-5GB. It’s best to get the current recommendations from Bacula Systems Support when possible, and then apply them and test using the btape speed test. Please note that block sizes can’t be changed easily once in production, so take the time to test beforehand.

Hopefully this has been a helpful overview of how to set up tape backup and recovery in Bacula. As always, the Bacula Main Manual has detailed information about each configuration option, as well as more example configurations. For Bacula Enterprise Edition customers, please don’t hesitate to contact support with questions as you set up tape devices.

About the author

Rob Morrison

Rob Morrison is the marketing director at Bacula Systems. He started his IT marketing career with Silicon Graphics in Switzerland, performing strongly in various marketing management roles for almost 10 years. In the next 10 years Rob also held various marketing management positions in JBoss, Red Hat and Pentaho ensuring market share growth for these well-known companies. He is a graduate of Plymouth University and holds an Honours Digital Media and Communications degree, and completed an Overseas Studies Program.

4 Comments
  1. Nick
    Nick

    Where and how are Bacula Systems training courses for system administrators conducted? How can I get there if know only Bacula Community?

    1. bs_admin
      bs_admin

      Hello Nikolai,

      It’s not a problem if you were only working with community edition. Our trainings (especially the basic Admin 1) is based on Bacula Community. Assuming that you’re interested specifically on tape backup I can assure you that the training includes this specific topic. You can register for the nearest one at https://www.baculasystems.com/bacula-administrator-i-training-course/.

  2. Alain
    Alain

    I keep all the information on the disc, it’s cheap. Should I switch to tapes instead?

    1. bs_admin
      bs_admin

      Alain, I think you should have both storage options. Disk can be useful for fast restores while tape is usually used in case of a disaster.

Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>