The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html
Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.
rsync
useful command line options
options affecting the transfer:
-S, --sparse -A, --acls -X, --xattrs -H, --hard-links -a, --archive -P --partial --progress --numeric-ids
rsync -avhSAXPH src dest/
rsync -avhSAXPH --numeric-ids --delete --exclude=/proc --exclude=/sys --exclude=/dev --exclude=/tmp --exclude=/run src dest/
Options affecting the output
-v, --verbose -h, --human-readable
Other flags to consider
-z
option adds compression.
for fat32 file32 systems
rsync -rtvhP --modify-window=1 --delete-after ...
If you don't like that all of your files show up as executables, you could remount the file system with different options.
for wizbackups
Use the H flag to preserve hardlinks for wizbackup dirs, since files that havent changed between backups are hardlinked to save space. This flag slows down overall transfer (not sure exactly how much), but it's probably not worth using otherwise.
caveats
be careful about trailing slashes on the source directory. if you include a slash, the contents of the directory will be synced into the destination, rather than a directory in the destination directory.
also be careful about syning a home dir from a remote server to your local home, or vice versa. this will likely screw up your ssh keys and other dot files / directories.
Note the leading /
characters in the --exclude=
parameters. These are
necessary so you don't exclude paths like /foo/tmp
.
Overall progress
Here is an example of using df to track progress of a long running transfer. For a long transfers, the v and P flag mostly just waste cpu cycles and I (Ian) don't use them.
replace /mnt/monolith below
mnt=/mnt/monolith
m() { df -BM $mnt | tail -n1 | awk '{print $3}'| sed 's/[^0-9]//g'; }
size-watch() {
old=$(m)
while true; do
sleep 600
new=$(m)
printf "%s %'d MB/min in last 10 minutes\n" "$(date)" $(( (new - old) / 10))
old=$new
done
}
size-watch