by Ken Task.
Pardon the length of this ...
I take it you were referring to this reference?
https://docs.moodle.org/31/en/Tools_for_backing_up_server_files
Basic command:
rsync OPTIONS SOURCE DESTINATION
where SOURCE would/should always be the moodledata directory
where DESTINATION would/should be either another location on same server that has
room/space or a remote server via ssh as a user that has access rights to write to and delete some directory and it's contents.
Referencing the page above, it shows:
rsync -auvtz --delete -e ssh mysshusername@example.com:/my/server/directory /my/backup/directory/
'to copy only the changed files to another host.
Seems to me the SRC and DEST parts are backwards there
rsync -auvtz --delete /my/server/directory -e ssh mysshusername@example.com:/my/backup/directory
SRC is /my/server/directory
DEST is via -e ssh mysshusername@example.com:/my/backup/directory
Here's one that I use to mirror the filedir to another location on the data partition of same server:
rsync -avzh --delete /home/Moodle/filedir /home/backup/filedir
When run it shows/does only those that are new to the mirrored directory (home/backup/filedir):
sending incremental file list
filedir/0d/e0/
filedir/0d/e0/0de0c3934f7abc56b96e87dd159c5fc13aac8ad9
sent 5.36M bytes received 64.39K bytes 309.89K bytes/sec
total size is 564.21G speedup is 104038.25
Here's another that syncs from one server to another server on an alternate ssh port (i.e., not port 22):
/usr/bin/rsync -av --delete . -e "ssh -p 7997" root@moodle.tld:/home/sosbackup/
Command is run from the /home/backup directory of the sos server ... the '.' at the tail end of options ... it is the SOURCE directory.
The DEST directory is on moodle.tld in /home/sosbackup/
When the command is run, here is output (other files ... shorten the list here):
sending incremental file list
./
drupalcode-2016111973558.tar
other files ....
deleting noodles/moodle306-code-20161008224625.tar
deleting other files
moodles/coloodle311-code-20160702.tar
moodles/ other files ...
moodles/moodle29/
deleting moodles/moodle29/backup-moodle2-course-8-meinconflict-20150727-1814.mbz
deleting moodles/moodle29/other files
sqldailydumps/campsigwp.sql
sqldailydumps/coloodle.sql
sqldailydumps/other sql files
sent 8457765445 bytes received 248629 bytes 23994366.17 bytes/sec
total size is 15799043662 speedup is 1.87
Suggestion ... rather than working with a directory you *don't* want to lose or mess up in any form or fashion, suggest syncing a test directory with junk files in it to a test directory on another server.
Just remember one could be using rsync to push or pull.
In the case of backups ... archiving to another server ... the concept is PUSH.
'spirit of sharing', Ken