[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Best way to duplicate HDs



On Tue, Jan 01, 2002 at 08:39:39AM -0500, Keith Elder wrote:
> This brings up a  question. How do you rsync something but keep the
> ownership and permissions the same.  I am pulling data off site nightly
> and that works, but the permissions are all screwed up.

rsync -avxrP --delete $FILESYSTEMS backup-server:backups/$HOSTNAME

Some caveats if you want to fully automate this...
  - remove -vP (verbose w/ progress)
  - --delete is NECESSARY to make sure deleted files get deleted from the
    backup
  - FILESYSTEMS should be any local filesystems you want backed up (-x
    won't cross filesystems, makes backing up in NFS environment easier)
  - obviously this doesn't preclude a bad guy checking out
    backup-server:backups/otherhostname (use ssh keys, and invoke cmd="cd
    backups/hostname; rsync with whatever daemon options" will limit that)
  - on backup-server, rotate the backup every 12 hours or whatever.  
        - rsync -ar --delete store/hostname.2 store/hostname.3 
        - rsync -ar --delete store/hostname.1 store/hostname.2 
        - rsync -ar --delete backups/hostname store/hostname.1
        # that could be better optimized, but you get the idea

I've used this rsync system to successfully maintain up to date backups w/
great ease, AND restore very quickly...  use a LinuxCare Bootable Business
Card to get the target fdisked and ready, then mount the filesystems as
you desire, and rsync -avrP backup-server:backups/hostname /target.  I got
a 700mb server back online in under 20 minutes from powerup to server
serving requests (the rsync itself is 3 to 5 minutes).  Making sure you
do (cd /target; lilo -r . -C etc/lilo.conf)) is the only tricky part.

-- 
Ted Deppner
http://www.psyber.com/~ted/



Reply to: