Day: May 26, 2019

Using rsync to create backup

rsync is mostly used to synchronize files between Internet servers, but this powerful tool also can be used to create local backup.

I have an external harddisk for backup. Instead just using copy command to save my computer file to the external harddisk I want to verify first if the file saved there is exactly the same I have in the computer. Case the files are different I want to save a newer version and rename the older version.

It is easy to do using rsync:

rsync --suffix="_`date +%Y.%m.%d.%H.%M`" -bacH localdirtobackup /media/user/external_harddisk/

If the file exist in the external harddisk, but its content is different then it will be renamed to filename_YEAR.month.day.Hour.Minute

It also could interesting to know when some file was corrupted in the computer or external harddisk, or if some virus is changing your files.