Skip to main content

Setting up backups with Bareos

Bareos is an open-source backup solution for client-server environments. Using the droplet storage backend, the storage daemon can write volumes directly to an S3 bucket.

Prerequisites

  • A running Bareos installation (Director, Storage Daemon, File Daemon)
  • Package for the S3 backend installed, e.g. bareos-storage-droplet
  • S3 access credentials and a Bucket, e.g. bareos-backups

1. Create a droplet profile

/etc/bareos/bareos-sd.d/device/droplet/centron.profile:

use_https = true
host = s3.internet1.de
access_key = IHR_ACCESS_KEY
secret_key = IHR_SECRET_KEY
pricing_dir = ""
backend = s3
aws_auth_sign_version = 4
aws_region =

Restrict file permissions:

chown bareos:bareos /etc/bareos/bareos-sd.d/device/droplet/centron.profile
chmod 600 /etc/bareos/bareos-sd.d/device/droplet/centron.profile

2. Define the S3 device in the Storage Daemon

/etc/bareos/bareos-sd.d/device/S3-Device.conf:

Device {
Name = "S3-Device"
Media Type = "S3-Object"
Archive Device = "S3 Object Storage"
Device Options = "profile=/etc/bareos/bareos-sd.d/device/droplet/centron.profile,bucket=bareos-backups,chunksize=100M"
Device Type = droplet
Label Media = yes
Random Access = yes
Automatic Mount = yes
Removable Media = no
Always Open = no
Maximum Concurrent Jobs = 1
}

3. Create a storage resource in the Director

/etc/bareos/bareos-dir.d/storage/S3-Storage.conf:

Storage {
Name = "S3-Storage"
Address = "sd.example.com" # FQDN des Storage Daemons
Password = "PASSWORT_DES_SD" # muss zur Director-Ressource im SD passen
Device = "S3-Device"
Media Type = "S3-Object"
}

4. Display the pool and job on S3

Pool {
Name = "S3-Pool"
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 30 days
Maximum Volume Bytes = 50G
Label Format = "s3-vol-"
}

Job {
Name = "backup-server01-s3"
JobDefs = "DefaultJob"
Storage = "S3-Storage"
Pool = "S3-Pool"
}

5. Reload the services and test them

systemctl restart bareos-sd
systemctl reload bareos-dir

bconsole
* status storage=S3-Storage
* run job=backup-server01-s3 yes
* messages

After the first job, volume objects should appear in the bucket (aws s3 ls s3://bareos-backups/ --endpoint-url https://s3.internet1.de).

Restore

Restores run as usual via bconsole:

* restore client=server01-fd

Bareos reads the required chunks transparently from the bucket.

Notes

  • Chunk size: 100 MB is a good standard; larger chunks reduce the number of requests, whilst smaller ones improve parallelism.
  • Do not apply lifecycle rules to the Bareos bucket – retention is controlled by pools/retention in Bareos.
  • For higher throughput, define multiple devices with the same media type and increase Maximum Concurrent Jobs.