rsyncdiscovery
A test script to find out rsync parameters for backup.
Conclusion
To copy src
to tgt
:
rsync -r -H -l -g -o -t -D -p --del src tgt
And you will end up with
tgt/src
being a mirror of the original src
directory.
Test usage
The shell script's source and this document lives here
To discover the tests:
./test_rsync.sh list_tests
To run the tests:
sudo ./test_rsync.sh
Background
I would like to create a file-level backup of some files. My goal is to use rsync to do the job. As rsync has a lot of command line switches, first, I would need to know, which ones to use. For this, I have some expectations:
- Backup is recursive
- Extra files removed
- Links are preserved
- Symlinks are preserved
- Symlinks are not rewritten
- Preserve permissions
- Modification times are preserved
- Special files reserved
And of course, a test-driven approach will be used. Bash does not prevent you from writing tests, so go ahead.
Ending slash: The ending slash is important on the source side, if you wish to say to copy the contents of that directory, not the directory itself.
The archive mode includes:
r
- recursivel
- copy symlinks as symlinksp
- preserve permissionst
- preserve modification timesg
- preserve groupo
- preserve ownerD
- preserve device and special files
And the manual also states, that it does not include:
H
- preserve hard linksA
- preserve ACLsX
- preserve extended attributes
For me the hardlinks seem to be important.
No comments:
Post a Comment