This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tutorials:rsync-backup [2011/10/02 15:52] – Fix ToC memnon | tutorials:rsync-backup [2012/05/05 20:11] (current) – Link fix, $ID memnon | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Backing Up $HOME Using rsync ====== | ||
| + | |||
| + | ===== Content ===== | ||
| + | |||
| + | * [[#Why should I backup?]] | ||
| + | * [[# | ||
| + | * [[#Why rsync?]] | ||
| + | * [[#Basic rsync backup.]] | ||
| + | * [[# | ||
| + | * [[#Caveats and extras]]\\ | ||
| + | * [[#Trailing directory slashes]] | ||
| + | * [[#The " | ||
| + | * [[#Rsync and symlinks]] | ||
| + | * [[#Rsync and Cron]] | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ===== Why should I backup? ===== | ||
| + | |||
| + | As is [[http:// | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | |||
| + | What you will need to perform a mirror of your home directory on SDF to another location is a computer with ssh and rsync installed and enough space to store your SDF files. The instructions below are being run on an x86 running Linux, but should be suitable for Mac OS/X and Windows running cygwin. Please read the ssh and rsync documentation on those platforms for any differences. | ||
| + | |||
| + | ===== Why rsync? ===== | ||
| + | |||
| + | Rsync will allow you to syncronize your data on SDF to an area on another computer. Using rsync will enable you to copy only new files or files that have changed. This saves bandwidth for both parties and greatly speeds up the operation. Rsync is in current development, | ||
| + | |||
| + | ===== Basic rsync backup. ===== | ||
| + | |||
| + | Only a portion of rsync' | ||
| + | |||
| + | You may want to add the switch " | ||
| + | |||
| + | You will be using rsync on a machine to CONNECT TO SDF. What follows is NOT designed to be run from SDF. On the machine you wish to backup your SDF home directory to, issue the following: | ||
| + | |||
| + | "rsync -avz -e ssh // | ||
| + | |||
| + | What does this mean? \\ | ||
| + | |||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * // | ||
| + | * "/ | ||
| + | * "/ | ||
| + | |||
| + | You will be prompted for your SDF password. Upon completion, rsync will report a few statistics to you such as the amount of data transfered and your average throughput. When you run this command subsiquently rsync will only backup new and changed files. | ||
| + | |||
| + | ===== Restoring ===== | ||
| + | |||
| + | Restoring a single file is as easy as using " | ||
| + | |||
| + | ===== Caveats and extras ===== | ||
| + | |||
| + | ==== Trailing directory slashes ==== | ||
| + | |||
| + | Most often, the trailing slash when specifying a directory is optional. To rsync, however, the trailing slash has meaning when specifying the source directory. Omitting the trailing slash cause the entire directory structure of the source files to be recreated on the destination machine. Specifying the trailing slash, however, causes the directory structure only to be recreated from the given directory. | ||
| + | |||
| + | For example: | ||
| + | |||
| + | "rsync -avz -e ssh username@sdf.lonestar.org:/ | ||
| + | |||
| + | The above would produce "/ | ||
| + | |||
| + | ==== The " | ||
| + | |||
| + | Rsync' | ||
| + | |||
| + | ==== Rsync and symlinks ==== | ||
| + | |||
| + | As stated above, the default behavior for copying links with rsync' | ||
| + | |||
| + | ==== Rsync and Cron ==== | ||
| + | |||
| + | Backups work best if they are done regularly. A nice way to make sure you don't forget to make regular backups is to have your computer remember for you by placing your rsync command in a cron job. Due to a password being involved, this is not a completly straightforward task and some caution is required. For a very good first read on this subject, please read [[http:// | ||
| + | |||
| + | $Id: rsync-backup.html, | ||