ZFS Backup Server: Configuration File

Configuration File

The configuration file is a flat text file. The config is broken up into two sections: a global configuration and a host configuration. Each host that needs to be back up must be specifically defined in the config file. The location of the config file is defined at the top of the script.

The global configuration options specify default behavior. The global options are:

Option Name Example Value Description
keep-daily 7 Number of DAYS to keep the daily backups
keep-weekly 42 Number of DAYS to keep the weekly backups -- note this is NOT the number of weeks to keep them
weekly-backup-day Sun The three letter abbreviation of the day to consider a weekly backup (capitalization matters). Use a value that would be returned by the "date" command.
protocol-path rsh=/usr/bin/rsh Each protocol must be defined with the path to it's binary. Multiple protocols can be defined. For example:
#protcol-path           name=/path/to/program
protocol-path           ssh=/usr/bin/ssh
protocol-path           rsh=/usr/bin/rsh
default-protocol rsh The default protocol name as defined in the protocol path option
show-start-line no Show a status line when a backup starts, set to yes to enable
find-path /usr/bin/find The path to the find command on remote the remote hosts (used for globbing paths)
rsync-path /usr/local/bin/rsync The path to rsync on remote the remote hosts
compression yes Whether rsync should use compression or not (valid: 'yes' or 'no')

Each host is contained within a host block in the configuration. A host block defines all configuration specific to that host. The sample configuration provided includes standard configurations.

# Sample host entry:
host hostname.domain {
        # The thread-id assigns this host to a specific thread.  Each thread runs
        # in parallel, but each host in the thread is backed up serially.  This
        # allows long running rsync's to be separate from other hosts and allows
        # utilizing the bandwidth capabilities for separate WAN links at the same
        # time.
        thread-id       any-thread-id
        # The protocol statement defines the protocol to use for this host The
        # protocol must be defined using the protocol-path global statement.  If
        # protocol is omitted, the global default-protocol option is used.
        protocol        rsh
        # The path statement defines a path to be backed up from the host
        path    /path/to/dir
        # Using a '*' at the end of the path will have the backup program used
        # the defined (or default) protocol to connect to the host and get a list
        # of directories based on the glob.  This is useful for directories that
        # contain very large numbers of files, which causes rsync to use more
        # system resources.
        # The command used to glob is:
        #     find /some/other/path/* -type d -maxdepth 0
        # Note that this will not include hidden directories or any files in the
        # specified path
        path    /some/other/path/*
	# Defining a pre-script will run a script on the remote host before
	# the backup starts.  You can use this script to create a snapshot
	# of a MySQL server ZFS dataset.
	pre-script      /path/to/script/on/remote/host  arg1 arg2 arg3
        # This format for the path statement allows you to relocate a remote path
        # to another location on the backup server.  This is useful for backing
        # up ZFS snapshots of a filesystem or other preporatory directories
        # created by a pre-script
        path    /remote/path/=/local/path
        path    /path/.zfs/snapshot/snapname=/path
	# The exclude statement defines an exclude regular expression.  The
	# pattern excluded is excluded from ALL paths defined for host.
	# This path is relative to ALL paths specified with the "path"
	# configuration.  For example, if you define:
	# 	path /foo
	# 	exclude /bar
	# This will recursively exclude /foo/bar from the backup.
        exclude /exclude-dir