We have two external hard disks that we use to keep backups of our data.
The way we do that is by using the command rsync
that makes our life easy.
Specifically, we use the following command to synchronize the first hard disk with the second one:
rsync -avh --delete --progress "path/to/source/" "path/to/destination/";
rsync
is a fast, versatile, remote (and local) file-copying tool, it is available in almost every system (GNU/Linux, Unix (MacOS as well) and Windows).The parameters we use are the following:
-a
,--archive
enables archive mode which is equal to-rlptgoD
(no -H,-A,-X)
In more detail it enables all of the following options
-r
,--recursive
recurse into directories
-l
,--links
copy symlinks as symlinks
-p
,--perms
preserve permissions
-t
,--times
preserve modification times
-g
,--group
preserve group
-o
,--owner
preserve owner (super-user only)
-D
same as--devices
--specials
--devices
preserve device files (super-user only)
--specials
preserve special files-v
,--verbose
it increases verbosity of the output-h
,--human-readable
outputs numbers in a human-readable format--delete
deletes extraneous files from destination directories--progress
shows progress during transfer