Backing up with rsync

Backup is the best protection against data loss, whether through hardware failure, user error, or malware. In my case, I back up regularly to an external hard disk as well as to CDs and DVDs.

When I back up, I don't bother sifting and organizing them anymore: I prefer to copy the entire directory wholesale. Problem here is: if you just copy the directories over, there's a good chance you'll end up with files and directory trees duplicated several times.

Instead of just copying an entire directory to the backup disk, consider using rsync.

rsync synchronizes files and subdirectories from one location to another while minimizing data transfer using delta encoding when appropriate. That is, when you rsync a directory, it only transfers files and subdirectories that have changed. This saves on the time as well as eliminates the problem of duplication.

While rsync can work over network transfers, you don't need a network to make use of it. You can synchronize two local directories.

Here's an example command I use to back up my data to my USB hard disk.

rsync -av /home/dominique /media/usbdisk/dominique

The -a option tells it to do a number of things, such as traverse directories recursively, preserve ownership, preserve time stamps, etc.

The -v option tells it to go into verbose mode.