Linux Reality Episode 63 - Home Servers Part 9: Backup Servers Extra Notes TAR Tar will create a single file archive of another file or directory. Like a ZIP file. Format of command: tar -zcvf backup.tar.gz directory/ -z: use gzip compression -c: compress -v: verbose -f: filename Can make this a simple cron job, maybe overwrite old tarball, or add something to the tarball name, like the date: tar -zcvf backup.$(date +%y%m%d).tar.gz text/ This will create tarball with this name: backup070520.tar.gz Also, try using SaraB, which uses DAR. RSYNC Rsync will make incremental backups. Format of command: rsync -a source/ destination/ -a means archive -v verbose -r recursive -z compress Trailing Slashes Can Matter For example: rsync -a source destination/ produces destination/source/stuff, whereas this command: rsync -a source/ destination/ produces destination/stuff. The presence or absence of a trailing slash on the destination has no effect. Using the --delete flag If a file was originally in both source/ and destination/ (from an earlier rsync, for example), and you delete it from source/, you probably want it to be deleted from destination/ on the next rsync. However, the default behavior is to leave the copy at destination/ in place. Assuming you want rsync to delete any file from destination/ that is not in source/, you'll need to use the --delete flag: rsync -a --delete source/ destination/ Using Cron: To run the rsync-with-backup command from the previous section, for example, edit the root cron table: (as root) crontab -e Then add the following line: * 4 * * * rsync -a --delete source/ destination/ This will run at 4am every day. Finally, can add SSH to the mix with -e ssh (be sure to exchange SSH keys as necessary first): rsync -avz -e ssh source/ remoteuser@remotehost:/destination/ Can also exclude with --exclude or --exclude-from . Here is an example of both: rsync -avz -e ssh --exclude "*.html" --exclude "tmp/" --exclude-from list_of_excluded_stuff.txt --delete source/ remotehost:/destination/ LINKS: http://sbackup.sourceforge.net/HomePage http://www.bacula.org/ http://sarab.sourceforge.net/ http://www.mikerubel.org/computers/rsync_snapshots/ http://www.sanitarium.net/golug/rsync_backups.html http://www.howtoforge.com/rsync_incremental_snapshot_backups http://finmath.uchicago.edu/~wilder/Security/rsync/ http://troy.jdmz.net/rsync/index.html http://gradha.sdf-eu.org/textos/dar-differential-backup-mini-howto.en.html http://www-128.ibm.com/developerworks/linux/library/l-backup/?ca=dgr-lnxw41Backup http://linuxgazette.net/104/odonovan.html Backup MySQL databases: http://sourceforge.net/projects/automysqlbackup/ Updated: Mon May 21 21:33:09 EDT 2007