Mario Castelán Castro [2015-10-20 12:39:59-05] wrote:
> Take a look at the "--link-dest" option of rsync; it provides
> deduplication at the file level.
> You can create one directory for each snapshot within a directory for
> backups, then each time you add a new snapshot, pass the previous
> snapshot to "--link-dest".
I suggest "rsync --link-dest" too. Symbolic links are a nice way to
store the previous (and currently newest) backup destination directory.
So maybe like this in the backup destination machine:
time_stamp=$(date +%Y%m%dT%H%M%S%z)
destination_base_dir=some_directory
rsync -aH --link-dest="$destination_base_dir/newest" \
[backup source] "$destination_base_dir/$time_stamp"
if [ $? -eq 0 ]; then
# Update the symbolic link to point the just created backup dir:
ln -sfn -- "$time_stamp" "$destination_base_dir/newest"
# Delete old backups:
find "$destination_base_dir" -mindepth 1 -maxdepth 1 -type d \
-mtime +90 -exec /bin/rm -fr -- {} +
fi
Attachment:
signature.asc
Description: PGP signature