Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
tutorials:rsync-backup [2011/04/30 14:38]
clemens created
tutorials:rsync-backup [2011/10/02 15:52]
memnon Fix ToC
Line 4: Line 4:
 ===== Content ===== ===== Content =====
  
-  * [[#why|Why should I backup?]] +  * [[#Why should I backup?]] 
-  * [[#requirements|Requirements]] +  * [[#​Requirements]] 
-  * [[#rsync|Why rsync?]] +  * [[#Why rsync?]] 
-  * [[#backup|Basic rsync backup.]] +  * [[#Basic rsync backup.]] 
-  * [[#restoring|Restoring]] +  * [[#​Restoring]] 
-  * [[#caveats|Caveats and extras]]\\ +  * [[#Caveats and extras]]\\ 
-    * [[#slashes|Trailing directory slashes]] +    * [[#Trailing directory slashes]] 
-    * [[#delete|The "​--delete"​ option]] +    * [[#The "​--delete"​ option]] 
-    * [[#links|Rsync and symlinks]] +    * [[#Rsync and symlinks]] 
-    * [[#cron|Rsync and Cron]]+    * [[#Rsync and Cron]]
  
 \\ \\
  
-===== [[|Why should I backup?]] =====+===== Why should I backup? =====
  
 As is [[http://​sdf.lonestar.org/​index.cgi?​faq?​MISC?​01| clearly outlined in the FAQ]], SDF backups up system files only. SDF does NOT maintain backups of userspace. If there is something stored in your home directory that is important to you then you need to take on the responsibility of protecting it. Paragraph two of the [[http://​sdf.lonestar.org/​index.cgi?​abuse/​aup|SDF AUP]] also clearly outlines the fact that taking care of your files is your responsibility. As is [[http://​sdf.lonestar.org/​index.cgi?​faq?​MISC?​01| clearly outlined in the FAQ]], SDF backups up system files only. SDF does NOT maintain backups of userspace. If there is something stored in your home directory that is important to you then you need to take on the responsibility of protecting it. Paragraph two of the [[http://​sdf.lonestar.org/​index.cgi?​abuse/​aup|SDF AUP]] also clearly outlines the fact that taking care of your files is your responsibility.
  
-===== [[|Requirements]] =====+===== 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. 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?]] =====+===== 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,​ open source, and very flexible. It is possible to create a variety of different backups using 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,​ open source, and very flexible. It is possible to create a variety of different backups using rsync.
  
-===== [[|Basic rsync backup.]] =====+===== Basic rsync backup. =====
  
 Only a portion of rsync'​s options and capabilities will be discussed here. See the rsync man page for further details. Only a portion of rsync'​s options and capabilities will be discussed here. See the rsync man page for further details.
Line 51: Line 51:
 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. 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 =====
  
 Restoring a single file is as easy as using "​sftp"​ or "​scp"​ to transfer the file from your backup directory back to SDF. To restore your entire directory, simply issue the rsync command you used for backing up your SDF data with the source and destination reversed. Restoring a single file is as easy as using "​sftp"​ or "​scp"​ to transfer the file from your backup directory back to SDF. To restore your entire directory, simply issue the rsync command you used for backing up your SDF data with the source and destination reversed.
  
-===== [[|Caveats and extras]] =====+===== Caveats and extras =====
  
-==== [[|Trailing directory slashes]] ====+==== 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. 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.
Line 67: Line 67:
 The above would produce "/​local/​backup/​dir/​path/​to/​home"​ on the destination machine. Adding the trailing slash on the source directory would simply dump the contents of of the directory into the destination dir. The above would produce "/​local/​backup/​dir/​path/​to/​home"​ on the destination machine. Adding the trailing slash on the source directory would simply dump the contents of of the directory into the destination dir.
  
-==== [[|The "​--delete"​ option]] ====+==== The "​--delete"​ option ====
  
 Rsync'​s default behavior is to copy and update files on the source to the destination. If a file is removed from the source directory it is retained at the destination. Adding the "​--delete"​ option causes files removed from the source directory to also be removed from the destination. Rsync'​s default behavior is to copy and update files on the source to the destination. If a file is removed from the source directory it is retained at the destination. Adding the "​--delete"​ option causes files removed from the source directory to also be removed from the destination.
  
-==== [[|Rsync and symlinks]] ====+==== Rsync and symlinks ====
  
 As stated above, the default behavior for copying links with rsync'​s "​-a"​ option is to copy simlinks as links. On sdf $HOME/html and $HOME/​gopher are links and will not be backed up unless you either specify the full path to those directories as separate backups or you add the "​-L"​ option after the "​-a"​ option to your rsync backup. As stated above, the default behavior for copying links with rsync'​s "​-a"​ option is to copy simlinks as links. On sdf $HOME/html and $HOME/​gopher are links and will not be backed up unless you either specify the full path to those directories as separate backups or you add the "​-L"​ option after the "​-a"​ option to your rsync backup.
  
-==== [[|Rsync and Cron]] ====+==== 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://​troy.jdmz.net/​rsync/​index.html|Troy Johnson'​s]] nice writeup on the subject. 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://​troy.jdmz.net/​rsync/​index.html|Troy Johnson'​s]] nice writeup on the subject.