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

Re: In House Incremental Backup System - bash script



On Fri, Aug 25, 2006 at 11:29:55AM +0200, Gilles Mocellin wrote:
> Le vendredi 25 août 2006 10:50, Hagakure a écrit :
> > Hi,
> >
> > I've got to upgrade our backup system (bash script) that currently uses
> > rsync to backup two sites to a storage server.
> >
> > Currently rsync is used to do an incremental copy of the data and then
> > we archive it using tar. Unfortunately, the archives are now taking up a
> > huge amount of hdd space.
> >
> > What I am looking for is a pointer so that we still use rsync to copy
> > the data, but rather than archive the entire backup, we have a tar file
> > for each days differences.
> >
> > Ideally, we would be able to insert the differences (file names only!)
> > into a mysql db so we can recover files quickly.
> >
> > I looked into various options, but wondered if anyone might have a
> > pointer to enable us to do this.
> >
> > Thanks,
> >
> > Haga
> 
> Hello,
> 
> I use rsnapshot. It does not make tar files of difference but several 
> directories, all showing the full archive at a date, but with the magic of 
> hard links and rsync, it stores only files wich have changed.
> 
> There's also rdiff-backup, but restores can only be done with rdiff-backup, 
> that's ennoying for me.
> 
> Also, dirvich.
Hi Haga,

I also used to use rsnapshot happily until I started to notice that the
rsync initiated by rsnapshot didn't fully work (basically for some
reason which I never figured out the --delete option was not alsways
honoured). I used -t option to rsnapshot to just print it's output and
put that in a shell script as seen below:

# --- 8< --------------------------------------------------------
#!/bin/bash

# delete the oldest backup
/bin/rm -rf /mnt/sda1/backup/daily.6/

#move all backups to the next older stage
mv /mnt/sda1/backup/daily.5/ /mnt/sda1/backup/daily.6/
mv /mnt/sda1/backup/daily.4/ /mnt/sda1/backup/daily.5/
mv /mnt/sda1/backup/daily.3/ /mnt/sda1/backup/daily.4/
mv /mnt/sda1/backup/daily.2/ /mnt/sda1/backup/daily.3/
mv /mnt/sda1/backup/daily.1/ /mnt/sda1/backup/daily.2/

#make a copy of the newest backup
/bin/cp -al /mnt/sda1/backup/daily.0/ /mnt/sda1/backup/daily.1/

#backup /home and log the result
/usr/bin/rsync -avx --delete /home/ /mnt/sda1/backup/daily.0/home/ > \
/root/store/rsnapshot.log 2>&1

#backup / and log the result
/usr/bin/rsync -avx --delete --exclude=/swap / \
/mnt/sda1/backup/daily.0/root/ >> /root/store/rsnapshot.log 2>&1

#touch the new backup for timestamp purposes
touch /mnt/sda1/backup/daily.0/
# --- 8< --------------------------------------------------------

I use this script to backup my /home and / to a USB disk, but you can 
run it as a cronjob on the backup server to backup any computer you want.

Hth
-- 
Andreas Rippl -- GPG messages preferred
                 Key-ID: 0x81073379

Attachment: signature.asc
Description: Digital signature


Reply to: