Backing up data is something that needs to be done regularly. In addition to local backups, we may need to back up data to or from remote locations. The rsync command synchronizes files and directories from one location to another while minimizing transfer time. The advantages of rsync over the cp command are that rsync compares modification dates and will only copy the files that are newer, rsync supports data transfer across remote machines, and rsync supports compression and encryption.
Backing up snapshots with rsync
How to do it...
- To copy a source directory to a destination, use the following command:
$ rsync -av source_path destination_path
Consider this example:
$ rsync -av /home/slynux/data slynux@192.168.0.6:/home/backups/data...