Names: jzhb
, jzhbck
Utility for managing backups and snapshots created via hard-links.
App manages efficiently directory structure of hard-link created backups of original data location. You can make backups every few hours, but app will ensure that older backups are pruned, so you will still have manageable amount of backups.
- last 7 days - leave all untouched
- then: leave 1 per day for 30 days
- then: leave 1 per week for 4 weeks
- then: leave 1 per month for 12 months
- ORIGIN - data volume - place(directory) of your files you want to backup
- BACKUP - backup volume
- $BACKUP/mirror - special directory on backup volume that is used to mirror ORIGIN volume.
- $BACKUP/snapshot-XXX - stored hard-linked snapshots, created by
cp -al $MIRROR $BACKUP/snapshot-$(date '+%Y%m%d%H%M')
In case that ORIGIN and BACKUP volume are stored
on the same volume, MIRROR directory will not be used.
In other cases we use rsync for maintaining MIRROR
in sync with BACKUP. Same/different volume is checked by df -P "%s" | awk 'END{print $1}'
In situation (one volume) that everything is located in the same volume, there si very little space overhead, because all backups are just hardlinks. In case that there are two different volumes (two volumes), there is a copy of everything in backup volume plus addition very efficient hardlinked snapshots.
- one volume:
sizeof(BACKUP) = sizeof(SNAPSHOTS)
- two volumes:
sizeof(BACKUP) = sizeof(ORIGIN)+sizeof(SNAPSHOTS)
Note: Please note that it is not supported if ORIGIN directory consists of various mountpoints. In such special case one can use option --use_rsync
to force making rsync BACKUP mirror, otherwise it won't work properly.
It used to store defaults for calling one backup task. It is stored in python .conf file:
[backuptask1]
origin=/home/jiri
backup=/var/backup/home-jiri
min-age-hours=6
permissions=False
be-nice=True
delete-unknown-snapshots=True
untouch-days=7
oneper-day=30
oneper-weeks=4
oneper-month=12
Prerequisities: python3
and python3-venv
(virtualenv) packages.
You can create distributable *bin.tgz
archive by running script ./build-zip.sh
in development directory.
Installation procedure then consists of these steps:
download file jzhb-1.0-bin.tgz
tar xf jzhb-1.0-bin.tgz
cd jzhb-1.0
./install.sh
then:
jzhbck
"user" util is installed to~/bin/
- you can use
<installation-dir>/jzhb
to call it in locally - you should copy
default.conf
to your own configuration file and modify it according to your backup locations configuration file is param to callingjzhbck
Running without parameters will show help. Also you can run ./jzhb <command> --help
to show help for individual command.
backup Do one snapshot if last snapshot is older than min-age-hours.
clearing Just clear obsolete snapshots.
list List all snapshots with their usage information
restore This will restore data from snapshot or mirror to new...
status Print summary statistical information, disk usage, etc.
jzhbck backup my.conf backuptask1