A simple way to keep two drives in sync using rsync

backuprsyncsynchronization

I have an external USB drive, which I plug into a Linux NAS. I want to keep specific folders synchronised, so changes to files in FolderA on the NAS are applied to FolderA on the USB drive, and vice-versa.

Would an appropriate solution be to run an rsync command twice, i.e. once to sync NAS to USB and then again to sync USB to NAS, e.g. as follows:

# sync NAS to USB
rsync -av --stats /share/FolderA/ /share/USBDisk1/FolderA/

# sync USB to NAS
rsync -av --stats /share/USBDisk1/FolderA/ /share/FolderA/

I'd like the process to only update/add (no deletes, just to be safe), and to be as efficient as possible.

NB: I'll be running the commands as Cron job(s).

Thanks.

Best Answer

Yes, rsync running in both directions would be a (and probably the best) viable solution.