OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

3.4. Localhost Backup


This section describes how to backup specified directories on a single host to a local tape drive.

• First, the Storage device needs to be configured. Edit /etc/bacula/bacula-sd.conf add:


Device {

Name = "Tape Drive" Device Type = tape Media Type = DDS-4

Archive Device = /dev/st0 Hardware end of medium = No;

AutomaticMount = yes; # when device opened, read it AlwaysOpen = Yes;

RemovableMedia = yes;



RandomAccess = no;

Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"

}


The example is for a DDS-4 tape drive. Adjust the “Media Type” and “Archive Device” to match your hardware.


You could also uncomment one of the other examples in the file.

• After editing /etc/bacula/bacula-sd.conf the Storage daemon will need to be restarted:


sudo systemctl restart bacula-sd.service

• Now add a Storage resource in /etc/bacula/bacula-dir.conf to use the new Device:


# Definition of "Tape Drive" storage device Storage {

Name = TapeDrive

# Do not use "localhost" here

Address = backupserver # N.B. Use a fully qualified name here SDPort = 9103

Password = "Cv70F6pf1t6pBopT4vQOnigDrR0v3LT3Cgkiyjc" Device = "Tape Drive"

Media Type = tape

}


The Address directive needs to be the Fully Qualified Domain Name (FQDN) of the server. Change

backupserver to the actual host name.


Also, make sure the Password directive matches the password string in /etc/bacula/bacula-sd.conf.

• Create a new FileSet, which will determine what directories to backup, by adding:


# LocalhostBacup FileSet. FileSet {

Name = "LocalhostFiles" Include {

Options { signature = MD5 compression=GZIP

}

File = /etc File = /home

}

}


This FileSet will backup the /etc and /home directories. The Options resource directives configure the FileSet to create an MD5 signature for each file backed up, and to compress the files using GZIP.

• Next, create a new Schedule for the backup job:


# LocalhostBackup Schedule -- Daily. Schedule {

Name = "LocalhostDaily" Run = Full daily at 00:01

}


The job will run every day at 00:01 or 12:01 am. There are many other scheduling options available.

• Finally create the Job:


# Localhost backup. Job {

Name = "LocalhostBackup" JobDefs = "DefaultJob" Enabled = yes

Level = Full

FileSet = "LocalhostFiles" Schedule = "LocalhostDaily" Storage = TapeDrive

Write Bootstrap = "/var/lib/bacula/LocalhostBackup.bsr"

}


The job will do a Full backup every day to the tape drive.

• Each tape used will need to have a Label. If the current tape does not have a label Bacula will send an email letting you know. To label a tape using the Console enter the following from a terminal:


bconsole

• At the Bacula Console prompt enter:


label

• You will then be prompted for the Storage resource:


Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog"

The defined Storage resources are: 1: File

2: TapeDrive

Select Storage resource (1-2):2


• Enter the new Volume name:


Enter new Volume name: Sunday

Defined Pools:

1: Default

2: Scratch


Replace Sunday with the desired label.

• Now, select the Pool:


Select the Pool (1-2): 1

Connecting to Storage daemon TapeDrive at backupserver:9103 ... Sending label command for Volume "Sunday" Slot 0 ...


Congratulations, you have now configured Bacula to backup the localhost to an attached tape drive.


Top OS Cloud Computing at OnWorks: