diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2014-06-16 12:00:31 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2014-06-16 12:00:31 +0200 |
| commit | ece4ab99df7f82216ab9d0b52a6f0ce3e22d828f (patch) | |
| tree | 31aa90be5940b5f81b95020c77c92e9ab76b488e | |
| parent | 530cd735f9dbbde5f64f6421e2f224d2909e08f7 (diff) | |
| download | zfs-backup-ece4ab99df7f82216ab9d0b52a6f0ce3e22d828f.tar.gz zfs-backup-ece4ab99df7f82216ab9d0b52a6f0ce3e22d828f.tar.bz2 | |
.zb-rc file support
| -rw-r--r-- | README.md | 28 | ||||
| -rwxr-xr-x | zb-cleanup | 1 | ||||
| -rwxr-xr-x | zb-pull | 1 | ||||
| -rwxr-xr-x | zb-snap | 1 |
4 files changed, 28 insertions, 3 deletions
@@ -12,13 +12,23 @@ The zfs backing-up tool. ha-ha. recent snapshots of `remote_zfs_object` to `local_zfs_object`, using ssh called with `ssh_connection` -## Installation&requirements +## Requirements `bash` shell and `zfs` utils are needed. `zb-pull` requires `ssh`. +zfs-backup requires GNU `date` or compatible, other `date` programs may fail. +Test is simple, check if this command works for you: + + date --date=now + +## Installation + Run `make install`, it installs itself to some `sbin/`. You can also specify `DESTDIR=/usr/local/` or similar. +For local changes (command aliases/wrappers, `PATH` setting etc.), file +`$HOME/.zb-rc` is sourced before any commands are run. + ## Example $ zb-snap tank/test @@ -78,7 +88,8 @@ And on remote backup machines: - `zb-pull` every morning - `zb-cleanup` with a slightly higher density number (it keeps more backups) -### What exactly does zb-cleanup clean up? +## FAQ +#### What exactly does zb-cleanup clean up? Candidates for backup deletion are determined like this: @@ -89,7 +100,7 @@ Candidates for backup deletion are determined like this: 3. Calculate `density*(Y-X)/Y`. If the result is less than 1.0, delete the _closer_ backup. -### How to determine your density and other numbers? +#### How to determine your density and other numbers? Density is "maximum ratio of time between backups to age of backups, in percent". @@ -113,6 +124,17 @@ Good approach to determine it (with all the other numbers) is this: value from the second row - in our case, daily. (probably in morning or somehow off-peak hours). +#### It doesn't work from cron! + +Check if the environment is the same as when you test the stuff from the command line. At least two common caveats exist: + +- `PATH` may be different in cron (which may select wrong `date` program to + run, or not find something other like custom-installed `zfs`). Edit + `~/.zb-rc` and fix `PATH` there. +- Some SSH authentication methods may not work from cron environment due to + missing `ssh-agent`, especially the password-protected privkeys. Descriptions + of many workarounds are available around the internet. + ## Disclaimer Be sure to verify that this software really fits your use-case before you use @@ -1,6 +1,7 @@ #!/bin/bash source /etc/profile >/dev/null +[ -f "$HOME/.zb-rc" ] && source "$HOME/.zb-rc" if [[ -z "$1" || -z "$2" ]] ; then echo "usage: $0 <zfs_object> <density_percent> [max_age]" >&2 @@ -1,6 +1,7 @@ #!/bin/sh source /etc/profile >/dev/null +[ -f "$HOME/.zb-rc" ] && source "$HOME/.zb-rc" if [[ -z "$1" || -z "$2" || -z "$3" ]] ; then echo "usage: $0 <ssh_remote> <remote_zfs_object> <local_zfs_object>" >&2 @@ -1,6 +1,7 @@ #!/bin/sh source /etc/profile >/dev/null +[ -f "$HOME/.zb-rc" ] && source "$HOME/.zb-rc" if [ -z "$1" ] ; then echo "usage: $0 <zfs_object>" >&2 |
