www.ScienceOfAtomics.com/linux
Backing up Data
Simple and effective hints

•  HOME  •  THEORY  •  PRACTICE  •    •  LOGIN  •  FORUM  •  CONTACT  • 

INTERNET   LINKS

The best way to backup your data is to use rsync. Take a quick look through the man pages for rsync and rsyncd.conf but skip the stuff on "modules" since they're not needed.

If you use an external USB drive for backup, there are only things you need to know:

  1. Rsync backs up directories by default, so plan your backups on a directory-by-directory basis.
  2. Always use the -a (archive) switch to retain file permissions etc.
  3. Use the --delete switch to remove old files from the backup. If this is omitted, old files will either be overwritten or left untouched.
  4. Add a trailing slash to the source path to prevent rsync from creating a top-level directory named for the final directory on the source path.

rsync -a --delete /path/to/source/ /path/to/destination

If you have a home network and wish to backup across it, rsync uses ssh so you'll need to know something about it. You'll need to know the network IP address of the other machine, along with a username (root is the most powerful as always) and password.

  1. Ssh keeps a record of known_hosts in ~/.ssh. If connection is refused, check that the other machine is not listed in this file. If it is, delete the line contaning its IP address.
  2. Use the standard user@host:/path/to/files format.

rsync -a --delete /path/to/source/ user@192.168.1.101:/path/to/destination

The following websites give useful information:

www.thegeekstuff.com/2010/09/rsync-command-examples

www.cyberciti.biz/tips/linux-use-rsync-transfer-mirror-files-directories.html

everythinglinux.org/rsync

www.howtogeek.com/135533/how-to-use-rsync-to-backup-your-data-on-linux