Disaster Recovery

This, and subseqent documents, will attempt to avoid being procedural, as technical details can and will change, but will attempt to be conceptual with general details.
Scope we will cover includes:

  • Data backup/restore
  • Security monitoring/access
  • Power outages

Data Backup/Restore

In CMS, the restoration goal is a Restoration Data Point (RDP) of 1 month, meaning that as a goal data should be restored to no more than one month before the disaster.
Archives are not kept for data, because they present an ongoing cost for media maintenance. Devices must be kept that read the media, or media needs to be transcribed to new media, eg. CD backups need CD readers → DVD backups need DVD readers, etc.

It became prohibitively costly to maintain a tape library for the few terabytes of data that needed to be backed up.
Tangentially, we discontinued subscription for the backup software involved in running a tape library for backup.

As a result, the entire backup/restore operation is cost free, minus the ongoing cost of physical tapes.
Currently, there is zero off-site backup. All physical media is stored on-site, either in the same room as the device(s) or in an adjacent room.

Devices to Backup/Restore

The philosophy has always been to store important data centrally, and then backup the data from the central location.
This is the opposite of a distributed system where data is kept on computation nodes, and then backed up individually, which complicates restoral and data disposition.
The file server (filer) in this case is the central data location in which all important data is held.
Fortunately, it is a NetApp device, which means it can handle NDMP, a network-based data backup protocol that defines basically 3 components in any backup system:

  • Data interface
  • Tape/SCSI interface
  • File history/logging interface

In this way, backup devices can be physically and geographically separate from the backup software and/or the data device to be backed up.

---
title: NDMP concept
---
flowchart LR
  subgraph BH[Backup Host]
    BS[[Backup Software]]
    Cache[(Database)]
  end
  subgraph NA[File Server]
    FS@{ shape: lin-cyl, label: "Disk storage" }
  end
  subgraph S[Storage Device]
    Tape@{ shape: flag, label: "Tape Device/Library" }
  end
  BS <-.-> FS
  BS <-- tape control --> Tape
  FS == file backup ==> Tape
  Tape -. index of files .-> Cache
  style BH fill:#333

Historically, as with the tape library and commercial software, the tape library was attached to the file server. The advantage of this was the data did not have far to travel and was much faster to write via local SCSI rather than Cat-6 network.

---
title: Historical Config with Tape Lib
---
flowchart LR
  subgraph BH[Backup Host]
    BS[[Backup Software]]
    Cache[(Database)]
  end
  subgraph NA[File Server]
    FS@{ shape: lin-cyl, label: "Disk storage" }
    Tape@{ shape: flag, label: "Tape Library/Robot" }
  end
  BS <-.-> FS
  BS <-- robot control --> Tape
  FS == file backup ==> Tape
  Tape -. index of files .-> Cache
  style NA fill:#000,stroke:#145ed5
  style BH fill:#111,stroke:#2dccc7

Current Configuration

Current Operation with the Tape Device on the Backup Host:

---
title: Current Config
---
flowchart LR
  subgraph BH[Backup Host]
    BS[[Backup Software]]
    Cache[(Database)]
    Tape@{ shape: flag, label: "Tape Device" }
  end
  subgraph NA[File Server]
    FS@{ shape: lin-cyl, label: "Disk storage" }
  end
  BS <-.-> FS
  BS <-- tape control --> Tape
  FS == file backup over network ==> Tape
  FS -. index of files .-> Cache
  style NA fill:#000,stroke:#145ed5
  style BH fill:#111,stroke:#2dccc7

The disadvantage here is the data to be backed up must travel over the network, to the Backup Host where the tape drive is attached.
This takes considerably longer, as network transfer speeds are much slower than SCSI.
However, there still remains the advantage of not needing to mount data for backup, which presents permissions and ownership complexity in the metadata. Instead of something like backing up over NFS, the data is directly streamed through the backup host to the tape device.

For this, the software BareOS is installed and configured, which we will detail the configuration below.
Detailed documentation regarding the software itself can be viewed via the link above.

Software Configuration

BareOS is divided into 3 constiuent parts/daemons: File Daemon (bareos-fd), Storage Daemon (bareos-sd), Director Daemon (bareos-dir).

The File Daemon runs on each client to be backed up and listens for the Director's call and sends them the data for backup. It is also responsible for the filesystem component of any restore operation.
The Storage Daemon handles any actions regarding storing the backed up files, including their disposition and indexing, as well as the destination of backed up data. There can be one or more Storage Daemons, each with their own physical devices/locations (such as tape drives, external drives, etc).
The Director Daemon orchestrates the interaction between the File and Storage daemons, and schedules backups to be performed, as well as the meta-information of all systems/data that has been backed up.

Configuration for all these is located in /etc/bareos, and their sub-directories, bareos-fd.d, bareos-sd.d, and bareos-dir.d, respectively.
For BareOS to work in the current configuation (above) with NDMP, we must first declare NDMP devices, because BareOS natively assumes all data to be backed up is available to the File Daemon locally installed, but we can't install software onto a NetApp Filer.
Therefore, we create NDMP Tape drives, which are exposed within the NDMP framework, and correspond to the physical tape devices for BareOS to access.

First, BareOS needs to know about the actual tape devices, so in /etc/bareos-sd.d/device/TapeStorage.conf:

Device {
  Name = TapeStorage0
  Device Type = Tape
  Media Type = Tape
  Archive Device = /dev/nst0
  DriveIndex = 0
  Label Media = no;           # lets Bareos label unlabeled media
  Random Access = no;
  AutomaticMount = yes;        # when device opened, read it
  Autochanger = no;            # there is no robot
  RemovableMedia = yes;
  AlwaysOpen = yes;
  Description = "Tape device. A connecting Director must have the same Name and MediaType."
  MaximumFileSize = 20GB       # default: 1000000000 (1GB)
}

Device {
  Name = TapeStorage1
  Device Type = Tape
  Media Type = Tape
  Archive Device = /dev/nst1
  DriveIndex = 1
  Label Media = no;           # lets Bareos label unlabeled media
  Random Access = no;
  AutomaticMount = yes;        # when device opened, read it
  Autochanger = no;            # there is no robot
  RemovableMedia = yes;
  AlwaysOpen = yes;
  Description = "Tape device. A connecting Director must have the same Name and MediaType."
  MaximumFileSize = 20GB       # default: 1000000000 (1GB)
}

We'll use 2 tape drives so that we don't need to change tapes constantly between full backups and incremental backups.
One drive will be used for full and the other for incremental;
/dev/nst0 for Level 0 backups
/dev/nst1 for Level 1 backups
These device names correspond to the Linux devices natively.

With BareOS now aware of the two tape devices, we'll enable NDMP within BareOS, setting /etc/bareos-sd.d/storage/bareos-sd.conf with:

Storage {
  Name = bareos-sd

  # remove comment from "Plugin Directory" to load plugins from specified directory.
  # if "Plugin Names" is defined, only the specified plugins will be loaded,
  # otherwise all storage plugins (*-sd.so) from the "Plugin Directory".
  #
  # Plugin Directory = "/usr/lib/bareos/plugins"
  # Plugin Names = ""
  NDMP Enable = yes
}
# This resource gives the DMA in the Director access to the Bareos SD via
# the NDMP protocol.
# This option is used via the NDMP protocol to open the right TAPE AGENT
# connection to your Bareos SD via the NDMP protocol.
# The initialization of the SD is done via the native protocol and is
# handled via the PairedStorage keyword.
Ndmp {
  Name = BARE-ndmp-tape
  Username = ndmpadmin
  Password = "<password>"
  AuthType = Clear
}

In the file /etc/bareos-dir.d/storage/Tape0.conf:

# Tape0 for all FULL backup
Storage {
  Name = Tape0
  Address = bare # N.B. Use a fully qualified name here (do not use "localhost" here).
  Password = "<bare-dir-password>"
  Device = TapeStorage0
  Media Type = Tape
  Maximum Concurrent Jobs = 10
}
# The above Storage entry should match SD->Director->bareos-dir.conf

# Same storage daemon but via NDMP protocol.
# We link via the PairedStorage config option the Bareos SD
# instance definition to a NDMP TAPE AGENT.
Storage {
  Name = NDMPTape0
  Address = bare.cms.caltech.edu
  Port = 10000
  Protocol = NDMPv4
  Auth Type = Clear
  Username = ndmpadmin
  Password = "<password>"
  Device = TapeStorage0
  Media Type = Tape
  PairedStorage = Tape0
}
Note

The ndmpadmin password in /etc/bareos-sd.d/storage/bareos-sd.conf must match the ndmpadmin password in /etc/bareos-dir.d/storage/Tape0.conf. Also, the "bare-dir-password" above must match the password in /etc/bareos/bareos-sd.d/director/bareos-dir.conf, such that it appears as:

Director {
  Name = bareos-dir
  Password = "bare-dir-password"
  Description = "Director, who is permitted to contact this storage daemon."
}

Of course, since we have 2 tape drives, we need two NDMP tapes; NDMPTape0 and NDMPTape1, so there needs to also be a /etc/bareos-dir.d/storage/Tape1.conf file with similar settings for TapeStorage1.
Conceptually, we'll have:

---
config:
  htmlLabels: false
  markdownAutoWrap: false
---
flowchart LR
  ND0[NDMPTape0] e0@--> T0[TapeStorage0] e1@--> d0["`*/dev/nst0*`"]
  e0@{ animate: true }
  e1@{ animate: true }
  ND1[NDMPTape1] e2@--> T1[TapeStorage1] e3@--> d1["`*/dev/nst1*`"]
  e2@{ animate: true }
  e3@{ animate: true }

Consequentially, any action involving either NDMPTape[0|1] or TapeStorage[0|1] automatically translates to /dev/nst[0|1] on the local system.

Scheduling and Volumes

Because the current configuration involves backing up over the network, its best to break up the datasets by volume on the file server, lest anything go wrong during the backup, the entire operation needs to reset from the beginning.
With smaller datasets; i.e. by filesystem volume, if anything goes wrong during the backup, the operation resets only for that volume.

In /etc/bareos/bareos-dir.d/fileset, there are a set of files declaring each volume on the file server to backup similar to Filer_ams.conf:

Fileset {
  Name = "FILER_NDMPbu_ams"
  Include {
    Options {
      Compression = GZIP
      #If we have NDMP options, set them here via
      #meta = "TYPE=DUMP"
      #meta = "HIST=F"
      meta = "BUTYPE=DUMP"
    }
    File = /nfs_svm0/ams
  }
}

FILER_NDMPbu_ams is the name given to distinguish a backup set in BareOS that corresponds to the filesystem /nfs_svm0/ams on the file server.
(nfs_svm0) is the name local to the NetApp Filer for the SVM where all the data lives. See Filer Operation.
There are currently 17 volumes on the Filer, so there should be 17 config files similar to Filer_ams.conf, albeit specific to the volume. These files correspond to job declarations in /etc/bareos/bareos-dir.d/job/FILER-bu-<volume>.conf:

Job {
  Name    = "FILER-backup-ams"
  Type    =  Backup
  JobDefs = "FilerJob"
  Client  = "FILER-NDMP"
  FileSet = "FILER_NDMPbu_ams"
  Schedule = "WeeklyCycle"
}

Take note of FileSet -- they must match.
A new attribute is present: Client = "FILER-NDMP".
This corresponds to the client declared in /etc/bareos/bareos-dir.d/client/bareos-fd.conf:

Client {
  Name = bareos-fd
  Description = "Client resource of the Director itself."
  Address = localhost
  Password = "<bare-dir-password>"          # password for FileDaemon
}

Client {
  Name = FILER-NDMP
  Address = "131.215.140.151"
  Port = 10000
  Protocol = NDMPv4
  Auth Type = MD5
  Username = "ndmpuser"
  Password = "<password>"
}

Here ndmpuser has a different password from previously mentioned, as its created on the NetApp as a user specifically for NDMP backup.
We also specificy how we will be connecting to the FILER-NDMP client, and of course this corresponds to each job declared above.
Only one thing left to tie it all together: Job Definitions In /etc/bareos/bareos-dir.d/jobdefs/FilerJob.conf:

JobDefs {
  Name = "FilerJob"
  Type = Backup
  Level = Differential
  Client = "FILER-NDMP"
  Schedule = "WeeklyCycle"
  Storage = NDMPTape1
  Backup Format = dump
  Messages = Standard
  Pool = Differential
  Priority = 10
  Protocol = NDMP_BAREOS
  Write Bootstrap = "/var/lib/bareos/%c.bsr"
  Full Backup Pool = Full        # write Full Backups into "Full" Pool
  Differential Backup Pool = Differential # write Diff Backups into "Differential" Pool
}

This defines a default job which will use all the particulars related to the client for the given backup job.
How to know which backup job? The schedule, of course!
In /etc/bareos/bareos-dir.d/schedule/WeeklyCycle.conf:

Schedule {
  Name = "WeeklyCycle"
  Run = Level=Full Pool=Full Storage=NDMPTape0 1st fri at 21:00
  Run = Level=Differential Pool=Differential Storage=NDMPTape1 2nd-5th fri at 21:00
}

Every week the software will run.
On the first Friday of every month, at 9pm, a full (Level 0) will be done.
On every other Friday of every month, at 9pm, a differential (Level 1) will be done.

Note

Differential is different from Incremental, at least in the scheme of BareOS.
Full, of course is Level 0 -- backup everything.
Differential is Level 1 -- backup everything changed since Level 0.
Incremental is Level 1 -- backup everything changed since Level 0 or since last Level 1.
Each new Incremental becomes a new Level (Level 1 → Level 2 → Level 3, etc.) up to Level 8.

The trick here is "since last Level X".
In BareOS NDMP, and the NetApp, communication does not always happen to note the date/time of the Level 1 being done.
We can only be certain the date/time of Level 0 for each volume, as the NetApp does absolutely mark the date/time for this.
As a workaround, we back up Differential mainly, because that is based on the last Level 0.
The result is that, on average, each Differential backup will be larger each week until the next month's Level 0 full backup, which resets all the previous Differential backups.

The other file, /etc/bareos/bareos-dir.d/schedule/WeeklyCycleAfterBackup.conf is a placeholder to backup the BareOS Catalog:

Schedule {
  Name = "WeeklyCycleAfterBackup"
  Description = "This schedule does the catalog. It starts after the WeeklyCycle."
  Run = Full fri at 21:10
}

which will update its database of files backed up, after each backup has been completed.

Restoring

The most important part of this entire system: Restoring the data.

Since we use NDMP with BareOS, for performance reasons it is recommended to use bconsole rather than the web-ui.
For information about bconsole restore, see BareOS Restore Command.
bconsole is quite helpful when performing operations as it has an extensive help system built-in.
Of course, to access bconsole, you need to be logged into the backup host.

When using bconsole, take note of the above references to jobs, client name, and storage devices (like NDMPTape0), etc.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9