️ Bareos/Bacula — Enterprise Backup

If you like this project, consider supporting me on Buy Me a Coffee ☕️


tags:

Components & Default Ports

Component Description / Описание Default Port
Director Central scheduler & control / Центральный планировщик 9101
Storage Daemon Manages volumes & media / Управляет томами 9103
File Daemon (Client) Agent on backup clients / Агент на клиентах 9102
Catalog PostgreSQL/MySQL metadata DB / БД метаданных 5432 / 3306

[!TIP] Bareos is the actively maintained fork of Bacula with additional features and more frequent releases. Use Bareos for new deployments.


Installation

# Debian/Ubuntu (Debian 12 example)
wget -q https://download.bareos.org/current/Debian_12/Release.key -O- | apt-key add -
echo "deb https://download.bareos.org/current/Debian_12/ /" > /etc/apt/sources.list.d/bareos.list
apt update && apt install bareos bareos-database-postgresql  # Install / Установить

# RHEL / AlmaLinux / Rocky
dnf install bareos bareos-database-postgresql  # Install / Установить

Bacula (Original)

# Debian/Ubuntu
apt install bacula bacula-director-mysql bacula-sd bacula-fd

Initialize Catalog Database

/usr/lib/bareos/scripts/create_bareos_database     # Create DB / Создать БД
/usr/lib/bareos/scripts/make_bareos_tables          # Create tables / Создать таблицы
/usr/lib/bareos/scripts/grant_bareos_privileges     # Grant privileges / Выдать права

bconsole Basics

bconsole                                        # Start console / Запустить консоль

Common bconsole Commands

status dir                                      # Director status / Статус директора
status client                                   # Client status / Статус клиента
status storage                                  # Storage status / Статус хранилища
messages                                        # Show recent messages / Последние сообщения
quit                                            # Exit console / Выйти из консоли
help                                            # Show all commands / Все команды

Job Management

Run Jobs

run                                             # Run job (interactive wizard) / Интерактивный запуск
run job=BackupClient1 yes                       # Run specific job / Конкретная задача
run job=BackupClient1 level=Full yes            # Full backup / Полный бэкап
run job=BackupClient1 level=Incremental yes     # Incremental / Инкрементальный
run job=BackupClient1 level=Differential yes    # Differential / Дифференциальный

List & Monitor Jobs

list jobs                                       # All jobs / Все задачи
list jobs jobname=BackupClient1                 # Jobs for specific client / Задачи клиента
list jobs days=7                                # Jobs from last 7 days / Задачи за 7 дней
status dir running                              # Running jobs only / Только запущенные
list joblog jobid=<JOB_ID>                      # Log for specific job / Лог задачи

Cancel & Delete

[!WARNING] delete job removes the job record from the catalog permanently. The data on volumes is not immediately freed — run prune or purge afterward.

cancel jobid=<JOB_ID>                           # Cancel running job / Отменить запущенную
delete job jobid=<JOB_ID>                       # Delete job from catalog / Удалить из каталога

Volume & Pool Management

List Volumes

list volumes                                    # All volumes / Все тома
list volumes pool=Full                          # Volumes in specific pool / Тома в пуле
list media                                      # List media / Список носителей

Volume Operations

label                                           # Label new volume / Пометить новый том
update volume=Vol-0001                          # Update volume properties / Обновить свойства
prune volume=Vol-0001                           # Remove expired job records / Удалить устаревшие записи

# Purge removes ALL job data from volume — use with caution!
# / Purge
purge volume=Vol-0001

[!CAUTION] purge volume removes ALL backup records referencing that volume from the catalog, making recovery impossible. Only use when decommissioning a volume.

Pool Management

list pools                                      # List pools / Список пулов
update pool=Full                                # Update pool settings / Обновить настройки пула

Restore Operations

Interactive Restore

restore                                         # Restore wizard / Мастер восстановления
restore all                                     # Restore all files / Восстановить все файлы
restore select                                  # Select files interactively / Выбрать файлы

Restore by Job ID

restore jobid=<JOB_ID>                          # Restore from job / Восстановить из задачи
restore jobid=<JOB_ID> where=/tmp/restore       # Restore to alternate path / В другое место

Restore Latest

restore client=client1-fd select all done yes  # Restore latest / Восстановить последний

Catalog Queries

list files jobid=<JOB_ID>                       # Files in job / Файлы в задаче
list clients                                    # List clients / Список клиентов
list jobs client=client1-fd                     # Jobs for client / Задачи клиента
list backups                                    # All backups / Все бэкапы
query                                           # Custom SQL query / Кастомный SQL запрос

Client Operations

File Daemon Service

systemctl status bareos-fd                      # Check FD status / Проверить статус
systemctl start bareos-fd                       # Start FD / Запустить
systemctl enable bareos-fd                      # Enable at boot / Включить при загрузке

Estimate Backup Size

estimate job=BackupClient1                      # Estimate all / Оценить всё
estimate job=BackupClient1 level=Full           # Estimate full backup / Оценить полный бэкап

Configuration Essentials

Director Configuration

/etc/bareos/bareos-dir.d/

Job {
  Name = "BackupClient1"
  Type = Backup
  Level = Incremental
  Client = client1-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = File
  Messages = Standard
  Pool = Default
  Priority = 10
  Write Bootstrap = "/var/lib/bareos/%c.bsr"
}

Storage Daemon Configuration

/etc/bareos/bareos-sd.d/

Client (File Daemon) Configuration

/etc/bareos/bareos-fd.d/

Client {
  Name = client1-fd
  Address = <CLIENT_IP>
  FDPort = 9102
  Catalog = MyCatalog
  Password = "<PASSWORD>"
  File Retention = 60 days
  Job Retention = 6 months
  AutoPrune = yes
}

FileSet Example

/etc/bareos/bareos-dir.d/fileset/

FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /var/www
    File = /etc
  }
  Exclude {
    File = /tmp
    File = /var/tmp
    File = *.tmp
  }
}

Sysadmin Operations

Service Management

systemctl status bareos-dir                     # Director status / Статус директора
systemctl status bareos-sd                      # Storage Daemon status / Статус хранилища
systemctl status bareos-fd                      # File Daemon status / Статус File Daemon
systemctl restart bareos-dir                    # Restart director / Перезапустить директора

Logs & Monitoring

journalctl -u bareos-dir                        # Director logs / Логи директора
journalctl -u bareos-sd                         # Storage logs / Логи хранилища
journalctl -u bareos-fd                         # FD logs / Логи FD
tail -f /var/log/bareos/bareos.log              # Bareos combined log / Общий лог

Log Paths

/var/log/bareos/bareos.log         # Main log / Основной лог
/var/log/bareos/bareos-audit.log   # Audit log / Аудит лог

Logrotate / Logrotate

/etc/logrotate.d/bareos

/var/log/bareos/*.log {
    daily
    rotate 30
    compress
    delaycompress
    missingok
    notifempty
    create 640 root root
    sharedscripts
    postrotate
        systemctl kill --signal=HUP bareos-dir 2>/dev/null || true
    endscript
}

Troubleshooting

Common Issues

# "No Jobs running" / "Нет
status dir                                      # Check director / Проверить директора
messages                                        # Check messages / Проверить сообщения

# "Could not connect to client" / "Нет
systemctl status bareos-fd                      # Client FD running? / FD запущен?
telnet <CLIENT_IP> 9102                         # Test TCP connectivity / Тест соединения

# "Volume errors" / "Ошибки
list volumes                                    # Check volume status / Статус томов
update volume                                   # Fix volume status / Исправить статус

Catalog Maintenance

bareos-dbcheck                                  # Check catalog integrity / Проверить каталог
prune files                                     # Remove expired file records / Удалить устаревшие
prune jobs                                      # Remove expired job records / Удалить устаревшие задачи
prune volumes                                   # Remove expired volumes / Удалить устаревшие тома

Debug Mode

bareos-dir -d 100 -f                            # Debug director / Отладка директора
bareos-sd -d 100 -f                             # Debug storage / Отладка хранилища
bareos-fd -d 100 -f                             # Debug FD / Отладка FD

Documentation

On this page

linux Architecture Overview Components &amp; Default Ports Installation Bareos (Recommended Bacula (Original) Initialize Catalog Database bconsole Basics Common bconsole Commands Job Management Run Jobs List &amp; Monitor Jobs Cancel &amp; Delete Volume &amp; Pool Management List Volumes Volume Operations Pool Management Restore Operations Interactive Restore Restore by Job ID Restore Latest Catalog Queries Client Operations File Daemon Service Estimate Backup Size Configuration Essentials Director Configuration Storage Daemon Configuration Client (File Daemon) Configuration FileSet Example Sysadmin Operations Service Management Logs &amp; Monitoring Log Paths Logrotate / Logrotate Troubleshooting Common Issues Catalog Maintenance Debug Mode Documentation