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

Re: Recommended Backup/Restore Tools for Newbie



On (26/04/05 14:41), Parker, Matthew wrote:
> Hi,
> 
> I'm a relative newbie who has just installed Debian (Woody) on 5
> servers: 2 Firewalls, an Apache/TWiki server, a file server, and a
> workstation w/ Gnome. I'm looking for a solution to backup these systems
> (and also the data on the file server.)
> 
> I've done some reading on the web and have found any number of
> solutions: from shell scripts to commercial tools. In the interests of
> time I put together a list of 'system requirements.' I was wondering if
> people could make some suggestions as to which direction to take. 
> 
> Note: I don't need anything more than a recommended tool/approach. I'll
> take it from there.
> 
> Thanks!
> 
> 
> -----------------------------------
> -- Requirements of System Backup --
> -----------------------------------
> * Incremental Data Backups/SnapShots
> * System Restore: i.e. bare metal restore
> * Open Source
> * Something that a relative newbie can handle
> * "Popular" 
>    > Mature
>    > Well-Documentated
>    > Currently under development/testing
>    > possible relevance to the world of work (i.e. a good tool to put on
> resume)
> 
> 
> -------------------------
> -- Possible Candidates --
> -------------------------
> * Mondo Restore
> * Rsync
FWIW I use rsyncd combining what I found from two sources:
http://www.mikerubel.org/computers/rsync_snapshots/
http://finmath.uchicago.edu/~wilder/Security/rsync/

and came up with the following:
On file server:

ensure rsync runs as daemon, edit /etc/inetd.conf:
rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

Restart inetd as root
# /etc/init.d/inetd restart

Create /etc/rsyncd.conf:
[rsync]
    path = /home
    use chroot = no
    max connections = 4
    auth users = root
    hosts allow = x.x.x.x (backup server IP address)
    secrets file = /etc/.rs_sec
    uid = root
    gid = root


Create /etc/.rs_sec:
root:rootpasswd
$ sudo chmod 600 /etc/.rs_sec


On Backup server:
Create /etc/.rs_pass
rootpasswd
$ chmod 600 /etc/.rs_pass


Create /root/rsync.monthly.sh 
#!/bin/bash

# This script is called monthly from
# cron to move the monthly backups up a 
# level

# The full paths of the programs used in
# this script
        rm=/bin/rm
        mv=/bin/mv

        rm -rf /root/backup/snapshot/month.6
	mv /root/backup/snapshot/month.5 /root/backup/snapshot/month.6
        mv /root/backup/snapshot/month.4 /root/backup/snapshot/month.5
        mv /root/backup/snapshot/month.3 /root/backup/snapshot/month.4
        mv /root/backup/snapshot/month.2 /root/backup/snapshot/month.3
        mv /root/backup/snapshot/month.1 /root/backup/snapshot/month.2
        mv /root/backup/snapshot/week.4 /root/backup/snapshot/month.1


Create /root/rsync.weekly.sh
#!/bin/bash

# This script is called weekly from cron to move the weekly backups up a
# level

# The full paths of the programs used in this script

        rm=/bin/rm
        mv=/bin/mv

        rm -rf /root/backup/snapshot/week.4
        mv /root/backup/snapshot/week.3 /root/backup/snapshot/week.4
        mv /root/backup/snapshot/week.2 /root/backup/snapshot/week.3
        mv /root/backup/snapshot/week.1 /root/backup/snapshot/week.2
        mv /root/backup/snapshot/day.6 /root/backup/snapshot/week.1


Create /root/rsync.daily.sh:
#!/bin/bash

# This script is called daily from cron to perform overnight backups

# The full paths of the programs used in this script
        mv=/bin/mv
        cp=/bin/cp
        rsync=/usr/bin/rsync

# Good rsync options for backups.
    rsync_opts="-av --delete"

    # The name of the file containing the rsync connection password
        password="--password-file=/etc/.rs_pass"


	# Move all other backups up a level. Copy previous backup to
	# /backup/daily.
	# Backup FileServer according to the [rsync] sections of the
	# rsyncd.conf files
	# on FileServer.  Use the password given in /etc/.rs_pass.  Dump
	# any output and 
	# error messages to /var/rsync/FileServer
	mv /root/backup/snapshot/day.5 /root/backup/snapshot/day.6
	mv /root/backup/snapshot/day.4 /root/backup/snapshot/day.5
	mv /root/backup/snapshot/day.3 /root/backup/snapshot/day.4
	mv /root/backup/snapshot/day.2 /root/backup/snapshot/day.3
	mv /root/backup/snapshot/day.1 /root/backup/snapshot/day.2
	cp -al /root/backup/home /root/backup/snapshot/day.1
	     $rsync $rsync_opts $password FileServer::rsync \
	           /root/backup/home/ > /var/rsync/FileServer



*"FileServer" must be in /etc/hosts on Backup Server 
** Make sure /root/backup/home/ and /var/rsync exist with correct
permissions 
$ mkdir /root/backup/home/ /var/rsync
$ chmod 700 /root/rsync.daily.sh (do same for weekly and monthly
scripts)
add File Server to /etc/hosts


Cronjob for Auto backup and snapshot rotation:
20 23 1 * * /root/rsync.monthly.sh > /dev/null
25 23 * * 7 /root/rsync.weekly.sh > /dev/null
30 23 * * * /root/rsync.daily.sh > /dev/null

The above will do daily backups at 23:30 each night and Saturday's
backup will be stored as the next weekly backup.  On the 1st of each
month the oldest weekly backup will become the next monthly back up.

I've refined it as I go along and it all seems to work fine; hopefully I
got all the refinements in the above document I've been putting
together.

In practise, where I've put this together, the backup server located
remotely and accessed via VPN.


Regards

Clive							

-- 
www.clivemenzies.co.uk ...
...strategies for business




Reply to: