Serverspace Black Friday
JH
Joe Harris
October 1, 2020
Updated June 7, 2023

How to Configure Remote Backups using Bacula on Ubuntu 20.04

Backup Linux Ubuntu

Using another OS?

Select the desired version or distribution.

We recently set up file backup on a local Ubuntu Server 20.04 with Bacula, we will use this server as Bacula Director and Storage. In this tutorial, we will add settings for backing up a remote client.

Installing and configuring the client

The client is a remote machine running Ubuntu Server 20.04 whose data will be backed up. Let’s install the Bacula package for it.

sudo apt install bacula-client

Open the configuration file.

sudo nano /etc/bacula/bacula-fd.conf

Copy the password from the first Director’s section to an available location for future use on the Bacula server.

Director {
Name = Ubuntu-Server # Enter the name of the server’s Bacula Director here
Password = "6L8hAXhC3BES4OlbkI2F-v6Xq66Dem05v" #Copy this value
}

Also set the "Name" and "FDAddress" values in the FileDaemon section. The same name that we will set on the Bacula server for this file daemon client, and "FDAddress" must contain the IP address at which this client is available.

FileDaemon {
Name = Ubuntu-Client-fd
FDport = 9102
WorkingDirectory = /var/lib/bacula
Pid Directory = /run/bacula
Maximum Concurrent Jobs = 20
Plugin Directory = /usr/lib/bacula
FDAddress = 10.5.5.5
}

Save the file and restart the service.

sudo systemctl restart bacula-fd

To be able to restore files on this machine, create a folder and make bacula its owner.

mkdir /opt/restore
chown bacula:bacula /opt/restore

Configuring Bacula server

The Bacula server is already configured. We will use the existing storage and add a configuration to back up the client.

Set the server IP address in the “SDAddress” parameter of the “Storage” section in the /etc/bacula/bacula-sd.conf file.

Storage {
...
SDAddress = 10.5.5.1
}

Open the Bacula Director configuration file /etc/bacula/bacula-dir.conf.
Enter the server IP address in the “DirAddress” field of the Director section.

Director {
Name = Ubuntu-Server
...
DirAddress = 10.5.5.1
}

Enter the same address in the “Address” parameter of the “Storage” section.

Storage {
...
Address = 10.5.5.1
}

You also need to enter it in the “Address” parameter in the /etc/bacula/bconsole.conf file.
Now go to the /etc/bacula/bacula-dir.conf file again and add a new “Client” section.

Client {
Name = Ubuntu-Client-fd # Value of the “Name” field in the “FileDaemon” section on the client
Address = 10.5.5.5 # IP address of the client
FDPort = 9102
Catalog = MyCatalog
Password = "6L8hAXhC3BES4OlbkI2F-v6Xq66Dem05v" # Paste here the value of the “Password” parameter in the “Director” section on the client
}

Add a new “FileSet” section with a unique name. The “File” parameters set the paths to be backed up. You can add any number of them.

FileSet {
Name = "RemoteFS"
Include {
Options {
signature = MD5
}
File = /home/user1
File = /home/user2
}
}

Add a new “Schedule” section, set any unique name for it and select a time for backup.

Schedule {
Name = "RemoteDaily"
Run = Full daily at 05:00
}

Add a new Pool section.

Pool {
Name = RemotePool
Pool Type = Backup
Label Format = "RM-" # New label for separating files in the backup storage from local backups
}

Add a new Job section.

Job {
Client = "Ubuntu-Client-fd" # The “Name” value of the recently created “Client”
Name = "RemoteBackup"
JobDefs = "DefaultJob"
Enabled = yes
Level = Full
FileSet = "RemoteFS" # The name of recently added “FileSet’ section
Schedule = "RemoteDaily" # The name of the schedule for this Job
Pool = "RemotePool" # Must be equal to the recently created “Pool” name
Storage = LocalSD
Write Bootstrap = "/var/lib/bacula/RemoteBackup.bsr"
}

Also add the “Job” section to be able to restore data.

Job {
Name = "RemoteRestore"
Type = Restore
Client= "Ubuntu-Client-fd"
FileSet="Full Set"
Storage = LocalSD
Pool = "RemotePool"
Messages = Standard
Where = /opt/restore # Path to the folder that we created on the client for data restore
Bootstrap = "/var/lib/bacula/RemoteBackup.bsr"
}

Save and close the file and restart the Bacula service.

sudo systemctl restart bacula-dir

Running the remote server backup using Bacula

The backup Job will now start at the scheduled time. To start it immediately, go to the "bconsole".

bconsole

Output:

Connecting to Director 10.5.5.1:9101
1000 OK: 103 Ubuntu-Server Version: 9.4.2 (04 February 2019)
Enter a period to cancel a command.
*

Enter “run” and select the "RemoteBackup" job. Now you can check, modify or confirm the listed parameters. You can also change the destination for file recovery in this step, for example. It may be useful in the case of client loss.

Run Backup job
JobName: RemoteBackup
Level: Full
Client: Ubuntu-Client-fd
FileSet: RemoteFS
Pool: RemotePool (From Job resource)
Storage: LocalSD (From Job resource)
...

To view information about scheduled, running and terminated Jobs, type “status” and “1” then.
To restore data enter the “restore” command in the bconsole and follow the instructions.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 2
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.