Be careful about specifiying the source and destination directories: Mixing up the directories can delete your data. Better give it a dry run on some test data before checking it out on your real data (using the option —dry-run).

Now we put that rsync command into a shell script, for example “backup.sh”:

How To Mirror A Disk The Easy Way

Another application of rsync is mirroring a file system.

For example, in a server setup we usually have two disks. One disk contains the OS and the second should contain a copy of the latest functional version of the operating system, so that a disk failure can be undone just by switching to the mirror disk, without the need to reinstall the server completely from scratch.