codesnip

Adding a new backup source to Bacula

To add a new backup source to Bacula, use the following procedure.

Log in to your bacula installation:

#ssh root@bacula.YOURFQDN.com

On bacula.YOURFQDN.com:
(ALWAYS back up your working config file first!)

#sudo cp /etc/bacula/bacula-dir.conf /etc/bacula/bacula-dir.conf.bak

Edit /etc/bacula/bacula-dir.conf

#sudo nano /etc/bacula/bacula-dir.conf

There are a few notable sections we must edit to add a new target:

  • Job definition
  • File Set
  • Client File Services (if not already added to the director)

[hr top=”0″ bottom=”18″ /]

The Job definition record is typically as follows, you can usually duplicate and modify:

#Backup SOMETHING on SERVERNAME
Job {
Name = "Backup SOMETHING share"
JobDefs = DefaultJob
Type = Backup
Level = Incremental
Client = servername-fd
FileSet = "SERVERNAME-SOMETHING"
Schedule = "WeeklyCycle"
Storage = Storage01
Pool = BaculaPool
}
  • Replace SOMETHING with a description of what you’re backing up.
    1. That could be the name of a share (e.g. Clients).
  • Adjust the Name field for the friendly name of the backup job.
  • Edit the Client field to match the exact name of the bacula FileDaemon for a given server (See Adding a new FileDaemon).
  • Edit the FileSet name to exactly match the name specified in the FileSet directive later in the configuration file.
  • Edit the Storage field according to which storage pool you’d like. Be careful not to over-fill a pool with backups
    1. Options in this example:
      1. Storage01 = /iscsi/storage01/*
      2. Storage02 = /iscsi/storage02/*
      3. Storage03 = /iscsi/storage03/*
  • Match the Pool reference to the appropriate storage recycle pool to the storage you chose:
    1. Storage01 = BaculaPool
    2. Storage02 = BaculaPool2
    3. Storage03 = BaculaPool3

[hr top=”0″ bottom=”18″ /]

Locate the file set closest to the config you duplicated for backup job. Please note, these are different depending on backup of Linux/unix or Windows based file formats:

Windows FileSet:

#SERVERNAME SOMETHING Backup Set
FileSet {
 Name = "SERVERNAME-SOMETHING"
 Include {
  Options {
   signature = MD5
   Exclude = yes
   IgnoreCase = yes
   # Exclude Mozilla-based programs' file caches
   WildDir = "[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/Cache"
   WildDir = "[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/Cache.Trash"
   WildDir = "[A-Z]:/Documents and Settings/*/Application Data/*/Profiles/*/*/ImapMail"

   # Exclude user's registry files - they're always in use anyway.
   WildFile = "[A-Z]:/Documents and Settings/*/Local Settings/Application Data/Microsoft/Windows/usrclass.*"
   WildFile = "[A-Z]:/Documents and Settings/*/ntuser.*"

   # Exclude directories full of lots and lots of useless little files
   WildDir = "[A-Z]:/Documents and Settings/*/Cookies"
   WildDir = "[A-Z]:/Documents and Settings/*/Recent"
   WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/History"
   WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/Temp"
   WildDir = "[A-Z]:/Documents and Settings/*/Local Settings/Temporary Internet Files"

   # These are always open and unable to be backed up
   
   
   # Some random bits of Windows we want to ignore
   
   # Temporary directories & files
   WildDir = "[A-Z]:/WINNT/Temp"
   WildDir = "[A-Z]:/temp"
   WildFile = "*.tmp"
   WildDir = "[A-Z]:/tmp"
   WildDir = "[A-Z]:/var/tmp"

   # Recycle bins
   WildDir = "[A-Z]:/RECYCLER"

   # Swap files
   

   # These are programs and are easier to reinstall than restore from
   # backup
   }
   
   #these are the files to back up
   
   File = "D:/SOMETHING/PATH"
   File = "E:/SOMETHINGELSE/PATH"
 } 

}
  • Edit the comment to match your server and job info
  • Edit the Name field to match exactly what you specified in the JobDefs
  • Edit the File field at the bottom accordingly.
    1. You can specify more than one File path (recursive by default)
      1. NOTE: because this is running on a Linux system you must use / (forward slash) for it to understand slashes.
      2. You can use spaces in the path as long as the (required) quotes remain intact
      3. For Linux paths, use a root relative path e.g. /SOMETHING/PATH

[hr top=”0″ bottom=”18″ /]

Client File Services Connector (if not already serving files, see Adding a new FileDaemon):

# SERVERNAME Server
Client {
  Name = SERVERNAME-fd
  Address = SERVERNAME.YOURFQDN.com
  FDPort = 9102
  Catalog = MyCatalog
  Password = "XxXXXXxXXxXXXxxxXXXxxxXXxXX"      # password for FileDaemon
  File Retention = 7 days            # one week
  Job Retention = 7 days           # one week
  AutoPrune = no                    # Prune expired Jobs/Files
}
  • Edit the comment to match the server name
  • Edit the Name field to exactly what’s specified in the FD config.
  • Edit the Address field to the IP address or FQDN of the server hosting the FD
  • Match the Password field to the FD for that server.

[hr top=”0″ bottom=”18″ /]

Apply Changes

After modification of these core config files you must reload bacula director to detect changes:

#sudo service bacula-dir restart

If you modified FileDaemon configuration as well (in bacula-fd.conf) you must also restart the FD service:

#sudo service bacula-fd restart

[hr top=”0″ bottom=”18″ /]

Verify Changes

Enter bacula console to verify and test new configuration:

#bconsole

Bacula will respond with a console prompt:

Connecting to Director bacula.YOURFQDN.com:9101
1000 OK: 1 bacula-dir Version: 7.0.5 (28 July 2014)
Enter a period to cancel a command.
*

Check the status of your new backup set:

* run

Bacula responds with a console prompt:

Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: Backup Self
2: Backup FINANCE share
3: Backup HR share
4: Backup Accounting share
5: Backup CLIENTS share
6: Backup IT share
7: Backup Secure share
8: Backup Media share
9: Backup Secret Admin share
10: Backup SOMETHING share
11: BackupCatalog
12: RestoreFiles
Select Job resource (1-12):

Select your new set by entering the number (e.g. 10)

Run Backup job
JobName:          Backup SOMETHING share
Level:            Incremental
Client:           SERVERNAME-fd
FileSet:          SERVERNAME-SOMETHING
Pool:             BaculaPool (From Job resource)
Storage:          Storage01 (From Job resource)
When:             2015-10-14 09:15:07
Priority: 10
OK to run? (yes/mod/no):

Enter “yes”

Job queued. JobId=6258
You have messages.
*

Check status by either waiting for email confirmation of success/fail to your bacula report email address OR by entering this console command:

* status dir

Director status will show running and scheduled jobs. If error conditions exist please consult bacula documentation.