I am a great believer in having multiple backups of my data. I’ve been trying out the rsync facility available on Linux (and other Unix platforms). I think of rsync as remote synchronise with my current files.
My shell script
it="--itemize-changes"
dest="/media/colin/ADCD110/rsync/"
rsync $it -a /home/colin $dest --exclude-from='exclude-file.txt'
Where
- –itemize-changes lists the files being backed up
- -a This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission)
- -r recursive
- -l When symlinks are encountered, recreate the symlink on the destination.
- -t preserve modification times
- -g preserve group information
- /home/colin from this directory
- copied to /media/colin/ADCD110/rsync/, this external disk drive and directory
- –exclude-from=’exclude-file.txt’ exclude files from the file
and exclude-file.txt contains
colin/.docker/*
colin/Downloads/*
colin/snap/*
colin/.cache/*
colin/grafana-enterprise_13.0*
colin/snap/*
colin/snap
colin/.config/Code/logs/*
: Especially this one
colin/.docker/desktop/vms/0/data/Docker.raw
The output
When I ran the command I got output like
>f.st...... colin/.local/share/gnome-shell/application_state
.d..t...... colin/.local/share/nautilus/tags/
Where
- > means that a file is being transferred
- f this is a file
- d this is a directory
- s the file size is different
- t the modification time is different
which explains why the file was copied.
A new file (not in the backup) has
>f+++++++++ colin/new
What happens if I rerun it?
Usually no, of few files are copied. Once I start working, then the next time it runs it will backup any changed files, which are not on the exlude-files list.