Version 3.8.0

3.2.2. Incremental files backups

Incremental backups are file archives containing only the differences between files at specific time intervals.

Backups are created in GNU Tar format.

Incremental copies of files are made according to the following scheme:

Incremental backup overview

At the beginning of the year or on the first start of incremental backup, a full initial backup (identical to discrete backup) is created. Then at the beginning of each month - an incremental monthly copy from a yearly copy is created. Inside each month there are incremental ten-day copies. Within each ten-day incremental daily copies are created.

Since the tar file uses the PAX format, you do not need to specify the path to the incremental metadata files when restoring from an incremental backup. All information is stored in the PAX header `GNU.dumpdir` inside the archive.

Requirements:

  1. To make backups of your files, you have to ensure that you have installed GNU tar of whatever version is available on your OS.
  2. To back up the files, nxs-backup must be running on the same host where the files are located. Files can be stored locally, or mounted to a local directory.
  3. There should be enough space in the directory where the temporary backup is created. 
  4. The files should be readable by the user who runs nxs-backup.

Here is an example of configs for creating incremental backups of files for WP projects located in directory /var/www with exclude of log files.

This job config defines rules to make file backups for WordPress projects, stored in path /var/www/

job_name: inc_files
type: inc_files
tmp_dir: /var/backups/tmp_dump

sources:
- name: "wp_projects"
  save_abs_path: yes
  targets:
  - /var/www/*/wp-content/
  excludes:
  - log
  gzip: true

storages_options: 
- storage_name: local
  backup_path: /var/backups/files/inc
  retention:
    months: 12

If you want to use remote storage to copy your backups for long storing, you should use the corresponding storage name and its retention parameters:

S3 storage:

storages_options:
- storage_name: s3
  backup_path: /files/inc
  retention:
    months: 12

The used storage name must be declared and configured in the main config in the `storage_connects` block in nxs-backup.conf:

/etc/nxs-backup/nxs-backup.conf

storage_connects:
- name: s3
  s3_params:
    bucket_name: backups_bucket
    access_key_id: my_s3_ak_id
    secret_access_key: ENV:S3_SECRET_KEY
    endpoint: s3.amazonaws.com
    region: us-east-1

If you need another storage go to Storages

Reference for inc-files.conf:

# Job unique name
job_name: string # Required

# Type of the backup job. `inc_files`
type: string # Required

# Path to the directory used to temporarily store the backup during the creation process
tmp_dir: string # Required

# The option defines the order of rotation (deletion of old) backups, before creating a new copy or afterwards
safety_backup: bool # Default: false

# The option allows you to postpone copying until all backup parts of the job are complete before its delivery
deferred_copying: bool # Default: false

# Contains a list of individual subtasks for creating backups
sources: list 
    # Unique subtask name, used to separate storage paths
  - name: string # Required
    # List of paths for which backups will be created 
    targets: list 
        # Path to the files to be backed up. The glob format is supported, in this case a separate backup will be created for each occurrence.
      - string # Required
    # List of entries to exclude from backup
    excludes: list 
        # Entry to exclude from the backup. The glob format is supported.
      - string # Optional
    # The option enables compression of the backup archive
    gzip: bool # Default: false
    # The option activates saving the absolute path of files in the archive
    save_abs_path: bool # Default: true

# List of repositories to which backups should be delivered and their rotation rules
storages_options: list 
    # The name of the storage was added to the main config. The name `local` is used to store a copy on host.
  - storage_name: string # Required 
    # Path to directory where backups will be stored
    backup_path: string # Required
    # Set of rules to store and rotate the backups.
    retention: map 
      # Count of months to store backups.
      months: numeric # Default: 12