Subsections


Using Bacula CDP

Continous Data Protection (CDP) also called continuous backup or real-time backup, refers to backup of Client data by automatically saving a copy of every change made to that data, essentially capturing every version of the data that the user saves. It allows the user or administrator to restore data to any point in time.

CDP Example

The Bacula Enterprise CDP feature is composed of two components. A application (cdp-client or tray-monitor) that will monitor a set of directories configured by the user and a Bacula FileDaemon plugin responsible to secure the data on a Bacula infrastructure.

The user application (cdp-client or tray-monitor) is responsible to monitor files and directories. When a modification is detected, a copy of the new data is done into a spool directory. At a regular interval, a Bacula backup job will contact the FileDaemon and will save all the files archived by the cdp-client. The local data can be restored at any time without a network connection to the Director.

Configuration

FileDaemon Configuration

As with all Bacula plugins, the Plugin Directory directive in the FileDaemon resource of the bacula-fd.conf file needs to be set:

FileDaemon {
  Name = test-fd
  ...
  Plugin Directory = /opt/bacula/plugins
}

Plugin Parameters

In order to configure the CDP Plugin, one of the following parameters must be set:

The following parameters are used in the CDP job.

Director Configuration

FileSet {
  Name = cdp
  Include {
    Options {
      compression = LZO
    }

    Plugin = "cdp: userHome=/home/user1"
  }
}

Job {
  Name = CDP
  Client = myclient-fd
  Type = Backup
  Pool = Default
  Schedule = Hourly      # Choose a schedule
  Messages = Standard
  FileSet = cdp
}

CDP Client Configuration

-f <dir>
watches the directory <dir> for changes
-j <dir>
sets journal directory to <dir>. Default value is <HOME>
-s <dir>
sets spool directory to <dir>. Default value is <HOME>/.cdp-sdir
-d <nn>
set debug level to <nn>
-h
print help

Tray Monitor Configuration

You can setup the folders you wish to watch for changes by using the Tray Monitor.

Open the Tray Monitor options and click in the option Watch...:

Open CDP Client

You should see a window displaying the watched folders. Click in the button Add:

CDP Client Window

Select the folder you wish to watch:

Watching a Folder

You should see the watched folder listed, as in the image below:

Result

The Spool Directory and Scheduled Backups

The Spool Directory contains all files from the watched folders that were created and / or changed. It keeps a copy of every version of the files.

An example of this directory can be seen below:

Result

You must schedule backup jobs with a proper Files in order to backup those files with Bacula. Following this example, the job configuration would be:

FileSet {
  Name = cdp
  Include {
    Options {
      compression = LZO
    }
    Plugin = "cdp: userHome=/home/user1"
  }
}

Job {
  Name = CDP
  Client = myclient-fd
  Type = Backup
  Pool = Default
  Schedule = Hourly      # Choose a schedule
  Messages = Standard
  FileSet = cdp
}

The Job reads the journal file to select which files from the Spool Directory should be backed up. After that, the files will be available to be restored at any time:

Job Files

Important

It's necessary to keep either the cdp-client or the tray-monitor running in order to protect the directories being watched.

Limitations



bsbuild 2025-03-27