Project: Disk-to-Disk Backups with Rsync
Contact: Rob Tuck
Introduction
The goal of this projects is to replace Disk-to-Tape backups with Disk-to-Disk backups for all departmental UNIX/Linux server backups.
Usage Guides
Rsync Backup
Server setup:

Details will come later.  Just contact robtuck@cs for now.  Include backup client hostname and what time of day you would like the backup to run.  (This must be done before proceeding!)

Client setup:
  1. Install rsync on client (rsync 2.5.6 and above should be OK).
    • Linux : The rsync software is readily avaialable for most Linux distributions.
    • Solaris: Should be easily compiled under Solaris. Here is a copy of rsync 2.6.9 for Solaris 8 that works on LCSR machines (It's probably generic enouigh to run on any Solaris 8 machine): rsync-2.6.9.solaris-lcsr.tar

  2. Create /etc/rsyncd.conf file.
  3. Example file (for joe.rutgers.edu):

    pid file = /var/run/rsyncd.pid
    [joe-backup]
            path = /
            comment = joe backup
            uid = root
            gid = root
            auth users = root
            hosts allow = hold.rutgers.edu
            read only = true
            list = false
            secrets file = /rsync-backup/secret/rsyncd.secrets
            use chroot = true
            ignore nonreadable = true

    Notes:
    • hold.rutgers.edu should be replaced with the hold address on your local net (VLAN)
    • The "ignore nonreadable" option avoids problems with files that are unreadable by root. The assumption is that all files are able to be read by root or there is something wrong with the file.
    • You can omit the "pid file" option if you are not running rsync standalone (See Step 3).
           
    Network Hostname
    128.6.4.0 backup.cs
    128.6.5.0 hold-5
    128.6.13.0 hold-13
    128.6.13.127 hold-14
    128.6.25.0 hold-25
    128.6.26.0 hold-26
    128.6.60.0 hold-60
    128.6.75.0 hold-75
    128.6.168.0 hold-168
    128.6.168.192 hold-170

  4. Turn on rsync daemon.
    • Run standalone: rsync --daemon ( simple init script -- should work on Solaris and Linux)
    • xinetd (Linux): /sbin/chkconfig rsync on; /etc/init.d/xinetd reload
    • rsync will also run out of inetd (this method has not been tested!)
      1. Add to /etc/services: rsync 873/tcp
      2. Add to /etc/inetd.conf: rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
      3. send a SIGHUP signal to inetd

  5. Create directory /etc/rsync-backup.

  6. Create /etc/rsync-backup/structures file.
  7. Example file (for joe.rutgers.edu):
    # filesystem mount point     exclusions (relative to mount point)
     /
    /usr
    /home
    /var + /tmp - /tmp/*

    This example file backs up the root, usr, home, and var file systems.  It excludes the contents of /var/tmp but preserves the directory /var/tmp.  The exclusions follow the exclusions rules for rsync.  See the rsync documentation for more info.
    Note: You need to understand the rsync include and exclude rules (man rsync). I may try to simplify this in a later version.

  8. Create /etc/rsync-backup/backup.conf file. (optional -- current only supports setting admin's email address -- default is root@client )
    Example file (for joe.rutgers.edu):
    #client configuration file for rsync backup
    admin_email = robtuck@cs.rutgers.edu

  9. Mount "secrets" directory from hold.  Automount works and is the preferred way of mounting the "secrets", "logs", and "backups" directories.
    Note:
    Remember to substitute appropriate values for <vlan_number> and <client_name>.

    Linux automount
    1. add the following to the end of /etc/auto.master:   /rsync-backup /etc/auto.backup
    2. create /etc/auto.backup with the following as its contents:
      secret -vers=3,tcp,rsize=8192,wsize=8192,hard,intr,bg hold-<vlan_number>:/backup/secret/<client_name>
      logs -vers=3,tcp,rsize=8192,wsize=8192,hard,intr,bg hold-<vlan_number>:/backup/logs/<client_name>
      backups -vers=3,tcp,rsize=8192,wsize=8192,hard,intr,bg hold-<vlan_number>:/backup/backups/<client_name>
    3. restart autofs
    Solaris automount
    1. add the following to the end of /etc/auto_master:   /- /etc/auto_backup
    2. create /etc/auto_backup with the following as its contents:  
    3. /rsync-backup/secret hold-<vlan_number>:/backup/secret/<client_name>
      /rsync-backup/logs hold-<vlan_number>:/backup/logs/<client_name>
      /rsync-backup/backups hold-<vlan_number>:/backup/backups/<client_name>
    4. restart autofs
    NFS
    1. Create directory /rsync-backup
    2. mount hold-<vlan_number>:/backup/secret/<client_name>  /rsync-backup/secret    (ie. mount hold-26:/backup/secret/joe /secret)
    3. add entry to /etc/fstab ( or equivalent ) to ensure remount after boot

Restores:
Bare-metal restore - Doug Motto has written documentation of his experiences with bare-metal restores.

Notes:
  • For Solaris machines, it's advised to make a tar file of /devices and to place the file in a structure that is backed up by the disk-to-disk backups. The device files get managled when they are written to the backup server since it runs Linux instead of Solaris.
  • There is an issue with Rsync changing the atime attributes of files when performing checksumming to compare files. This may affect software that uses atime to detect when a file has changed. The effects can be readily seen in mail clients that access mail in mbox format.
RU Unix Admins Meeting Presentation -- Disk-to-Disk Backups with Rsync (powerpoint) (video podcast) (audio)
Easy Automated Snapshot-Style Backups with Linux and Rsync
rsync home page
Login