Search Site

Feed Section

Tuesday, December 14, 2010



How to Backup a Linux Directory/Folder Using rsync

Posted: 14 Dec 2010 02:33 AM PST

How to Backup a Linux Directory/Folder Using rsync: rsync is considered by many as one of the best free and open-source backup software for Linux/Unix. It is known for its simplicity, flexibility, and efficiency. rsync can quickly synchronize files and directories from one location to another while cutting down data transfer utilizing delta encoding when suitable. It is able to speed up file transfer by copying the differences between two files instead of copying an entire file each time.

rsync's mirroring takes place with only one transmission in each direction, an essential feature that is not found in other backup tools. Optionally using compression and recursion, it can copy or display directory contents and copy files. rsync is also smart enough to manage your files by preserving permissions and ownership information and copying symbolic links.

Serving files in the native rsync protocol or via a remote shell such as RSH or SSH, rsync listens on the default TCP port of 873 in daemon mode. When using SSH, rsync client executable must also be installed on the remote host.

rsync is installed by default on most if not all popular Linux distributions, so I would assume that you have it already. Otherwise, you can get it from HERE.

Now let's get down to business and show you some basic examples of using rsync to backup a Linux directory or folder:

If you want to synchronize two directories while overwriting existing files on the destination directory that has the same name as files found in the source directory, simply use this command:

rsync -r -t -v /source_directory /destination_directory

Usage:



If you don't want to overwrite newer existing files, use this:

rsync -r -t -v -u /source_directory /destination_directory

Usage:



You may also backup existing files before overwriting them using this command:

rsync -r -t -v -b /source_directory /destination_directory

Usage:



rsync is without doubt an excellent backup software that should be included in your arsenal of essential and handy utilities. There are still plenty of ways of using it, but that is all for now.


Related note: You may also be interested in checking out our list of online backup software.

No comments:

Post a Comment