Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.
Rsync is installed in Ubuntu by default. If you need a GUI front-end, install Grsync. It is available in Ubuntu Software Center and also Synaptic package manager.
sudo rsync -azvv source/ destination/Remote Backup
sudo rsync --dry-run --delete -azvv -e ssh source firstname.lastname@example.org:/path-to-destination/
An explanation of above options to commands:
- --dry-run This tells rsync to not actually do anything. It will just write a log of what it would do to the screen. Once you've made sure everything will work as you expect, you have to remove this option, and run the command again to perform the actual backup.
- --delete deletes files that don't exist on the system being backed up.(Optional)
- -a preserves the date and times, and permissions of the files (same as -rlptgoD).
- With this option rsync will:
- Descend recursively into all directories (-r),
- copy symlinks as symlinks (-l),
- preserve file permissions (-p),
- preserve modification times (-t),
- preserve groups (-g),
- preserve file ownership (-o), and
- preserve devices as devices (-D).
- -z compresses the data
- -vv increases the verbosity of the reporting process
- -e specifies remote shell to use