![]() There are a number of other choices that you can use, like -copy-links and -safe-links - the first copies the linked directories/files instead of the links themselves, while the second altogether avoids links pointing outside the tree. -links - to copy symbolic links as links (not to de-reference).-perms - to keep the permissions intact.-times - to maintain previous timestamps.-recursive - to recursively copy all sub-folders.The next few options specify the following: Compression ( -compress) is one of the features rsync provides to speed up data transfers, which is actually useful when synchronising with remote hosts. Some of the options like -verbose, -progress and stats are self-explanatory. links -delete -exclude *.pdf /home/user/Folder1/ /home/user/Folder2 Now, let’s look at another example, of a local copy of files, with some of the optional switches: rsync -verbose -progress -stats -compress -recursive -times -perms \ This will make it prompt for the password configured for the respective module, which can be bypassed by using the -password-file option (for use in scripts). This type of command is known as a “pull” command, while one with the remote path as destination is known as a “push” command. This command will copy all files from the remote module named path_1 to the local destination folder on the client. The rsync server can now be used from the client with the following command: rsync -avz host::path_1 /directory/at/destination Now that rsync has been configured on the server, you can start the stand-alone daemon with the command: rsync -daemon. The name of the secrets file, specifying the user names and passwords that are asked on connection to the client These do not refer to the actual users of the system. The names of users, as specified in the secrets file, that are allowed to connect to this path. ![]() The group name or ID that accompanies the uid parameter The user that should execute the actual transfer process The physical directory in the filesystem to be made available However, here is a brief explanation of some of them: Parameter Though I have only specified relevant and important settings here, you can take a look at the man page if you want a complete list of path-specific and global configuration parameters. More than one such path can be set up in a configuration file. All file specifications like motd (message of the day) file, log file, pid file, lock file, etc., come under global specifications, while parameters that follow the tag are path-specific settings To configure rsync in daemon mode, modify the /etc/nf file as follows: motd file = /etc/rsyncd.motdĪs you can see, this file has two sections - global parameters and path-specific settings. Also, it is obvious that for two-way synchronisation, we have to run rsync in daemon mode at both ends. The type of configuration used depends on the amount of traffic that our daemon is going to receive.įor significant traffic throughout the day, it is better to have a standalone daemon, otherwise the inetd configuration will do. It can be set up in one-way or two-way synchronisation methods, as a standalone daemon configuration or as inetd configuration. Normally, rsync can directly be used by specifying source and destination directories, but we usually set it up in daemon mode (an “rsync server”) at one end, so that it can receive requests for synchronisation. Overall, it is a simple, easy and efficient solution, where we don’t even need to install any complicated backup software. It can even be used to synchronise files locally (on the same system), if you want to make backups on the local machine itself (say, to a different drive, like a USB drive). rsync only transfers changed portions, and applies the changes to the file/directory tree copy on the other system, somewhat like the patch utility. ![]() This is very beneficial when synchronising large files or directory trees with gigabytes of data. The killer feature, really, is differential backups - rsync, with its unique algorithm, allows you to transfer only the changes made in a file/directory tree, instead of re-transferring all data. Another advantage is that it is bundled with almost all major Linux distributions today. This makes it one of the essential utilities in one’s toolkit, even if not planning to use it for backups. The rsync utility can be used cross-platform-Linux, Mac OS X and Windows (with Cygwin, of course) - and, in combination with cron and SSH, it can easily be scripted. Learn how to use this powerful utility that almost all experts use in their day-to-day work, to perform tasks like back-ups, and much more.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |