Debian 9 64 Bits – Configuration BareOS

Auteur : Vince Nadus
Date de publication : 23 juin 2018
bareos

1-Définition de la périodicité

nano /etc/bareos/bareos-dir.d/schedule/Nightly.conf
Schedule {
# name (required)
Name = "Nightly"
# run time
# allot of options are available,
# you can create multiple "Run =" times
# for now lets keep it simple
# this will run once a day, every day at 21:10
Run = daily at 21:10
}
chown bareos.bareos /etc/bareos/bareos-dir.d/schedule/Nightly.conf

2-Définition de la zone à sauvegarder

nano /etc/bareos/bareos-dir.d/fileset/LinuxConfig.conf
FileSet {
  # name (required)
  Name = "LinuxConfig"
  # include directory
  Include {
    Options {
      # calculate a signature for all files
      # both MD5/SHA1 are available, this is definitly for long term storage
      # a good idea to activate, note that the hash ads a bit of storage overhead
      Signature = MD5

      # compress every file with compression software
      # best known are : LZ4/GZIP (see manual for the others)
      # LZ4 is super fast in both compression and decompression
      # I would activate this always.
      Compression = LZ4

      # if supported by the OS, the read time won't be adapted
      # this would generate a bunch of writes for no reason on the client machine.
      noatime = yes
    }
    # the directory we are including
    # note: no trailing slashes!
    File = /etc
  }
}
chown bareos.bareos /etc/bareos/bareos-dir.d/fileset/LinuxConfig.conf

3-Définition du type de backup

nano /etc/bareos/bareos-dir.d/jobdefs/BackupLinuxConfig.conf
JobDefs {
  # name (required)
  Name = "BackupLinuxConfig"

  # type can be backup/restore/verify
  Type = Backup

  # the default level bareos will try
  # can also be Full/Differential(since last full)/Incremental(since last incremental)
  Level = Incremental

  # the default client, to be overwritten by the job.conf
  Client = bareos-fd

  # what files to include/exclude
  FileSet = "LinuxConfig"

  # the schedule we just created
  Schedule = "Nightly"

  # where to store it
  Storage = File

  # the message reporting
  Messages = Standard

  # the pool where to store it
  Pool = Incremental

  # the higher the value priority the lower it will be dropped in the queue
  # so for important jobs priority=1 will run first
  Priority = 10

  # the bootstrap file keeps a "log" of all the backups, and gets rewritten every time a 
  # full backup is made, it can be used during recovery
  Write Bootstrap = "/var/lib/bareos/%c.bsr"

  # in case these value's get overwritten
  # define where would be a good pool to write 
  # note that full backup will be used atleast once because no full
  # backup will exist
  Full Backup Pool = Full
  Differential Backup Pool = Differential
  Incremental Backup Pool = Incremental
}
chown bareos.bareos /etc/bareos/bareos-dir.d/jobdefs/BackupLinuxConfig.conf

4-Mise en relation du backup et du client

nano /etc/bareos/bareos-dir.d/job/dc-malo-etc-backup.conf
Job {
  # required
  Name = "dc-malo-etc-backup"

  # the default settings
  JobDefs = "BackupLinuxConfig"

  # overwrite the client here
  Client = "dc-malo"
}
chown bareos.bareos /etc/bareos/bareos-dir.d/job/dc-malo-etc-backup.conf

5-Prise en compte de la nouvelle configuration

bconsole
*reload

6-Lancement manuel de la sauvegarde

bconsole
* run job=dc-malo-etc-backup