Creating Backups

Scheduled Backup

By default, FMOS machines that hold the database or the data collector role automatically create backups on a daily basis. These backups are stored in a special directory, /var/lib/backup/firemon, which is on a separate, dedicated storage volume. As this volume is only used to store backups, as many backups as will fit on the volume are kept. Thus, the most points in time for recovery are always available. When a new scheduled backup is created, one or more backups are removed, or “pruned,” from the storage directory in order to make enough space available for the new backup.

The auto_backup system configuration variable can be used to control how and when scheduled backups are created. See Schedule an Automatic Backup.

When a backup is run, the file that is created is saved to /var/lib/backup/firemon/ by default. The file will be named HOSTNAME_DATE.backup, and will be readable only by the group fmbackup.

The backup file that is created will contain the FMOS system configuration, PostgreSQL database dump, and the file system archive.

If a server is configured to be a database, automatic backups are enabled by default; otherwise automatic backups are disabled. The default auto backup configuration does a backup daily at 23:48 UTC.

On-Demand Backup

The fmos backup command can be used to create a backup on demand. By default, when run without any command-line arguments, this command will create a new backup, named with the current date and time, in the default location (/var/lib/backup/firemon). To create a file in a different location or with a different name, pass the desired path as a positional argument, for example:

fmos backup my-special.backup

If only a filename is given, without the full path, the file will be created in the current working directory.

When creating an on-demand backup in the default location, it may be necessary to remove old backup files in order to make room. To facilitate this, the fmos backup command accepts a --prune argument. When this argument is supplied, the command will remove backup files from the destination directory, starting with the oldest, until there is enough space to create a new backup. If enough space cannot be freed while keeping at least one existing backup, the command will abort and no new backup will be created.

You must also include a new file name when you specify a location for the backup to be saved.

To perform a manual backup, complete the following steps.

  1. Access the server CLI.
  2. At the command prompt, type: fmos backup <location>
    By default, the backup is stored in the following location: var/lib/backup/firemon
  1. You can use SFTP to move the backup "off box" to be stored on another server.

Pruning Old Backups

The fmos backup command will automatically delete old backup files when it estimates that there is not sufficient free space in the destination directory to store another backup file. By default, when pruning old backups, FMOS will remove as many files as necessary to make enough space available, but it will keep at least one file. This helps ensure that there is always at least one good backup. If enough space cannot be freed without deleting the last backup, the command will abort and will not create a new backup.

To change the minimum number of backups that must be kept, pass a number after the --prune argument, for example:

fmos backup --prune 3

This will ensure that at least three backups are kept in the destination directory.

In most cases, only one or two existing backup files need to be deleted.

To avoid deleting any backup files, pass the --no-prune argument, for example:

fmos backup --no-prune

If there is insufficient space to create a new backup, the fmos backup command will abort with an error.

It is perfectly normal for the /var/lib/firemon directory to be very nearly full at all times. This is by design: since the only files that can ever be stored there are backups, leaving free space available on this filesystem would provide no benefit.