I am using rsync to create backups of my website. I would like to use --link-dest
to link to older backups and reduce the storage required, so duplicate unchanged files aren't stored multiple times.
I have tried several different path combinations, trying to make sense of the documentation. From what I can understand, the first path needs to be the full relative path from where the script file executes. The last path, is just the destination folder name without a path?
--link-dest=DIR This option behaves like --copy-dest, but unchanged files are hard linked from DIR to the destination directory. The files must be identical in all preserved attributes (e.g. permissions, possibly ownership) in order for the files to be linked together. An example: CW rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/
I'm obviously not making sense of this correctly, as everything I try fails, with a full duplicate of the files being created.
Here is an example of what I have currently:
rsync -zavx -e 'ssh -p22' \
--numeric-ids \
--delete -r \
--link-dest=../backups/websites/testsite.co.uk/17-06-2018/ [email protected]:~/public_html 18-06-2018/;
Is anyone able to clarify what the paths should be.
The script .sh file is located in on my computer at:
/Users/myname/Desktop/
Then the full paths to my directories are:
/Users/myname/Desktop/backups/websites/testsite.co.uk/17-06-2018/
/Users/myname/Desktop/backups/websites/testsite.co.uk/18-06-2018/
Any help with direction would be appreciated.
18-06-2018
so../
istestsite.co.uk
, and there is nobackups/...
there. Use an absolute pathname in link-dest to avoid any ambiguity.