Wednesday, April 15, 2026

How to configure Amazon S3 storage backend for Bareos

Configuration Steps 

Prerequisites

  • S3 bucket
  • IAM credentials 
  • bareos-storage-droplet package

Step 1: Installation

Install Backend: Install the bareos-storage-droplet package from the official Bareos repositories.

thushara@server:/etc/bareos$ sudo apt install bareos-storage-droplet
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  bareos-storage-droplet
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Step 2: Director Configuration

Define a Storage resource in the Bareos Director (e.g., /etc/bareos/bareos-dir.d/storage/s3.conf) and specify a dedicated Media Type.

root@BAT-NUC:/etc/bareos# cat /etc/bareos/bareos-dir.d/storage/s3.conf
Storage {
  Name = s3_Bareos
  Address  = BAT-NUC
  Password = "abcdefghijklmnopqrstuvwxyz"
  Device = "s3_dev1"
  Device = "s3_dev2"
  Media Type = "s3_object1"
  Maximum Concurrent Jobs = 2 # equals the number of devices
}

Storage {
  Name = s3_Bareos
  Address  = BAT-NUC
  Password = "abcdefghijklmnopqrstuvwxyz"
  Device = "s3_dev3"
  Device = "s3_dev4"
  Media Type = "s3_object2"
  Maximum Concurrent Jobs = 2 # equals the number of devices
}

Step 3: Storage Daemon Configuration

 Create a Device resource in the Storage Daemon pointing to the droplet backend

root@BAT-NUC:/etc/bareos# cat /etc/bareos/bareos-sd.d/device/s3.conf

Device {
  Name = "s3_dev1"
  Media Type = "s3_object1"
  Archive Device = S3 Object Storage
  Device Options = "profile=/etc/bareos/bareos-sd.d/device/droplet/s3.profile,bucket=my-backup-data,chunksize=100M"
  Device Type = droplet
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
  Description = "s3 device"
  Maximum Concurrent Jobs = 1
}
Device {
  Name = "s3_dev2"
  Media Type = "s3_object1"
  Archive Device = S3 Object Storage
  Device Options = "profile=/etc/bareos/bareos-sd.d/device/droplet/s3.profile,bucket=my-backup-data,chunksize=100M"
  Device Type = droplet
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
  Description = "s3 device"
  Maximum Concurrent Jobs = 1
}
Device {
  Name = "s3_dev3"
  Media Type = "s3_object2"
  Archive Device = S3 Object Storage
  Device Options = "profile=/etc/bareos/bareos-sd.d/device/droplet/s3.profile,bucket=my-backup-data,chunksize=100M"
  Device Type = droplet
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
  Description = "s3 device"
  Maximum Concurrent Jobs = 1
}
Device {
  Name = "s3_dev4"
  Media Type = "s3_object2"
  Archive Device = S3 Object Storage
  Device Options = "profile=/etc/bareos/bareos-sd.d/device/droplet/s3.profile,bucket=my-backup-data,chunksize=100M"
  Device Type = droplet
  Label Media = yes
  Random Access = yes
  Automatic Mount = yes
  Removable Media = no
  Always Open = no
  Description = "s3 device"
  Maximum Concurrent Jobs = 1
}

 Step 4: S3 Credentials Profile:

Create a droplet profile (e.g., /etc/bareos/bareos-sd.d/device/droplet/s3.profile) containing your IAM access keys, secret keys, and region..

root@BAT-NUC:/etc/bareos# cat /etc/bareos/bareos-sd.d/device/droplet/s3.profile
aws_region = ap-southeast-2
access_key = "abcdefghijklmnopqrstuvwxyz"
secret_key = "abcdefghijklmnopqrstuvwxyz"
host = s3.ap-southeast-2.amazonaws.com:443
use_https = true
backend = s3
aws_auth_sign_version = 2
pricing_dir = ""

 

To test an AWS S3 connection from PowerShell using the AWS CLI and Security Token Service (STS), follow these steps:
  1. Use the aws configure command to set up your access keys, secret key, and default region.

  2. Run the aws sts get-caller-identity command to confirm that your credentials are valid and active. This returns your Account ID, UserId, and ARN.

  3. Test S3 Connection, aws s3 ls To verify actual connectivity and permissions to S3, list your buckets.

  4. Test Access to a Specific Bucket If you only have permission for a single bucket, listing all buckets might fail even with a valid key. Instead, try listing the contents of that specific bucket: aws s3 ls s3://your-bucket-name

  5. To copy a file manually to Amazon S3 using PowerShell, you can use aws s3 cp "C:\path\to\yourfile.txt" s3://your-bucket-name/


Please run this command on bconsole see connection is working 
status storage=s3_Bareos
If it's working output should be as bellow 

Connecting to Storage daemon s3_Bareos at 10.3.1.1:9103 

Job inventory:

No Jobs running. 

Device status:

Device "s3_dev1" (S3) is not open.
Backend connection is working.
No pending IO flush requests.
==

Device "s3_dev2" (S3) is not open.
Backend connection is working.
No pending IO flush requests

Step 4: link your Pool

To finish the setup, you need to link your Pool resource to the specific Storage:
In your Bareos director configuration (usually under /etc/bareos/bareos-dir.d/pool/), add the Storage directive.
In this setup differential and incremental backups will continue to be stored in the local folder on the file server, while monthly full backups will now be directed to AWS S3.
/etc/bareos/bareos-dir.d/pool/Full.conf 
Pool {
  Name = Full
  Pool Type = Backup
  Storage = s3_Bareos
  Recycle = yes                       # Bareos can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 7 days           # How long should the Full Backups be kept?
  Maximum Volume Bytes = 100G          # Limit Volume size to something reasonable
  Maximum Volumes = 11                # Limit number of Volumes in Pool
  Label Format = "Full-"              # Volumes will be labeled "Full-<volume-id>"
  Recycle Oldest Volume = yes         #prune the oldest volume in the Pool, and if all files were pruned, recycle this volume and use it.
  Purge Oldest Volume = yes           #permits a forced recycling of the oldest Volume when a new one is needed.
}
--  

root@BAT-NUC:/etc/bareos# cat /etc/bareos/bareos-dir.d/pool/Incremental.conf
Pool {
  Name = Incremental
  Pool Type = Backup
  Storage = File                        
  Recycle = yes                       # Bareos can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 4 days          # How long should the Incremental Backups be kept?
  Maximum Volume Bytes = 100G           # Limit Volume size to something reasonable
  Maximum Volumes = 10                # Limit number of Volumes in Pool
  Label Format = "Incremental-"       # Volumes will be labeled "Incremental-<volume-id>"
  Recycle Oldest Volume = yes
  Purge Oldest Volume = yes           #permits a forced recycling of the oldest Volume when a new one is needed.
}

root@BAT-NUC:/etc/bareos# cat /etc/bareos/bareos-dir.d/pool/Differential.conf
Pool {
  Name = Differential
  Pool Type = Backup
  Storage = File                        
  Recycle = yes                       # Bareos can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 5 days          # How long should the Differential Backups be kept?
  Maximum Volume Bytes = 100G          # Limit Volume size to something reasonable
  Maximum Volumes = 10               # Limit number of Volumes in Pool
  Label Format = "Differential-"      # Volumes will be labeled "Differential-<volume-id>"
  Purge Oldest Volume = yes           #permits a forced recycling of the oldest Volume when a new one is needed.
  Purge Oldest Volume = yes           #permits a forced recycling of the oldest Volume when a new one is needed.
--  

No comments:

Post a Comment