Configuration¶
Dataset Properties¶
The behaviour of abgleich snap and abgleich free can be controlled through custom properties on ZFS datasets. ZFS’s inheritance rules apply. All properties can be overridden for individual operations using environment variables. The most important ones are:
abgleich:diff: boolean (on/off), defaults toonif not set. Check diff of dataset for determining if a snapshot is required. If a diff is asked for but this property is set tooff, a differences is automatically assumed to exist. Overridden viaABGLEICH_DIFF.abgleich:format: string, defaults toabgleich_%Y-%m-%dT%H:%M:%S:%f_backup. See documentation of chrono for options. Overridden viaABGLEICH_FORMAT.abgleich:overlap: integer, defaults to2. Number of overlapping snapshots on source and target.0is not valid.-1causes the source to keep all past snapshots, i.e. the overlap is not limited and old snapshots are not removed. Overridden viaABGLEICH_OVERLAP.abgleich:snap: string, defaults tochanged. Possible values arealways,changedandnever. Overridden viaABGLEICH_SNAP.abgleich:sync: boolean (on/off), defaults toonif not set. Dataset is included insyncand related cleanup operations, i.e.free. Overridden viaABGLEICH_SYNC.abgleich:threshold: integer, defaults to12582912bytes (12 MByte). Only if changes are smaller than this number of bytes, a dataset will be diffed to look for changes. Large diffs tend to be expensive/slow. Overridden viaABGLEICH_THRESHOLD.
Snapshot Logic¶
Whether or not snapshots are generated by abgleich snap is based on the following sequence of checks on each individual dataset:
The value of
abgleich:snapis checked. If set toalways, a snapshot is taken. If set tonever, no snapshot is taken. If set tochanged, further checks are performed to determine if the dataset has been changed since the last snapshot.The number of snapshots on the dataset is checked. If there is none, a snapshot is taken.
The
writtenproperty of the dataset is checked. If it equals0, no snapshot is taken.The type of dataset is checked. If it is a volume, a snapshot is taken.
The value of
abgleich:thresholdis checked. Ifwrittenexceeds this value, a snapshot is taken.The value of
abgleich:diffis checked. If it is set tooff, a snapshot is taken.It is checked whether the dataset is mounted. If it is unmounted, a snapshot is taken.
zfs diffis performed. If it generates output, a snapshot is taken. If there is no output, no snapshot is taken.
Snapshots are named by filling out the format string provided in abgleich:format.
Synchronization Logic¶
Datasets are considered for synchronization if abgleich:sync is on. At least one common snapshot most be found on source and target as an anchor, else the operation fails. If the target contains any snapshots following the last common snapshot, the operation also fails. If checks succeed, all snapshots after the last common snapshot on the source and transferred to the target.
Location Aliases¶
For convenience, entire locations can be given aliases, which must be written into a YAML configuration file.
apools:
abc: remotehost:root%some/data/set
xyz: otherhost:specialuser%meaningful/data/set
The following two command therefore have identical meaning:
abgleich ls abc
abgleich ls remotehost:root%some/data/set
The YAML configuration file is searched in the following locations in the following sequence, with the first file found being loaded:
path specified via
ABGLEICH_CONFIGenvironment variable if set{CWD}/abgleich.yaml{HOME}/.abgleich.yaml/etc/abgleich.yaml