In this age, storage is cheap. Data, however, is not. As is tradition for every quarter I make backups of all my important data onto a trusty external hard drive, and as a proponent of the 3-2-1 backup rule, I have to sync my backup to other drives for safekeeping.
The problem at hand is then: Given one master copy of the backup, how do I most efficiently sync it to other drives? It is also important that I tend to move files around, so I want to make sure that files deleted in the master copy are deleted in the other copies as well to save space. This means no Ctrl+A, Ctrl+C, then Ctrl+V directly, as it would preserve deleted files.
rsync -rvh --delete --size-only --progress /media/drive_1 /media/drive_2
rsync is of course the most handy tool for this.
-r will recursively sync data,
-v is for verbosity,
-h will show human-readable output, and
--size-only skips files that match in size.
--delete will delete destination files if not existing in source.
You can also use the
-a (archive) option instead of
-r, although it does not work well with NTFS mounts which I am using.
Windows has this handy tool built in with a helpful
/mir (mirror) option. This mirrors source (
D:) to destination (
E:), deleting files at the destination not present in the source:
ROBOCOPY D:\ E:\ /MIR /XO /r:0
Since I am syncing root directories in drives, annoying folders like
System Volume Information or
$RECYCLE.BIN in NTFS will cause permission issues.
/r:0 will inhibit the retry operation and avoid the “Access is denied.” errors when trying to copy system files.
Tip: There is a helpful “dry-run” switch for
/L (list). Make sure your source and destination are correctly set before proceeding!
Remember, always make backups!