This script makes a full backup in basedest
the first time it is executed on
a new day. Subsequent backups on the same day are level one incremental
backups. It keeps all backups from the current day, the first backup made
from each of the last days
, months
and years
.
The key feature of this script is that all full backups are made using hardlinks to unchanged files (file-level deduplication), thereby being storage efficient.
Credits to Mike Rubel, http://www.mikerubel.org/computers/rsync_snapshots/ (and everyone who have published similar articles based on Mike Rubels work)
Requires the packages crudini
and rsync
- Put
gossin-backup
andgossin-backup.conf
in the same directory (e.g./opt/gossin-backup/
), make suregossin-backup
is executable (chmod +x gossin-backup
) - Specify the location of the
rsyncexcludes
file ingossin-backup.conf
(default/opt/gossin-backup/
) - Specify the location of
source
(where to copy from, e.g./home/
) andbasedest
ingossin-backup.conf
- Create the directory for
basedest
(where to copy to, e.g./backups
), and make yourself the owner of it (sudo chown USER:GROUP DIR
) if you will not be running this asroot
(Note:basedest
has to be either an empty directory, or a directory where backups from the same source exists from previous use of this script) - Add a
crontab
entry specifying when you want to run it, e.g. every half hour (quarter past and quarter to):
15,45 * * * * username /opt/gossin-backup/gossin-backup
- This script has only been tested on Ubuntu (12.04, 14.04 and 16.04).
- (issue) Every run generates "No such file or directory" for month and year backups before they exist for the first time (I know, I really should fix this)
gossin-backup was written by Erik Hjelmås, [email protected]