Backup script (was Re: rsync problem)

Backup script (was Re: rsync problem)

Omer Zak w1 at zak.co.il
Tue Mar 22 06:23:25 IST 2011


I see I follow a different backup policy from Sambo.

Sambo keeps the last N backups in the same physical hard disk (or maybe
RAID array).  I keep a backup in a removable device.  My policy is to
never trust a single interconnected system with my data (so that I'll
not suffer massive data loss if my UPS+computer are fully zapped by
power surge from the mains, or if the computer's hard disk goes kaput).

I have two removable hard disks, each one containing an almost full
backup of my computer's filesystem.  I rsync to each of them in
rotation.  Since I don't want to spend several hours on backup each day,
this scheme allows me to keep only the two most recent backups (with
rsync saving time by not copying over a file which was not modified
since previous backup).

What I would like to have is a Time Machine (TM?) like scheme in which a
backup disk will enable me to see a snapshot of my computer's disk from
a certain date.  It can be implemented by making hard links.

Did anyone develop such a backup script?

--- Omer


On Mon, 2011-03-21 at 21:34 -0400, sammy ominsky wrote:
> On 21/03/2011, at 15:57, Omer Zak wrote:
> 
> > By the way, my own backup script uses the following rsync flags:
> > rsync -avH --progress --max-delete=200000 --delete --delete-excluded
> > --exclude-from=$EXCLUSIONS_FILE $FROM $TO
> 
> 
> This looks like a fun game!  I'll show you mine if you'll show me yours.
> 
> #!/bin/bash
> 
> date=`date "+%Y-%m-%d"`
> 
> mkdir /nas/web-backup/Backups/${date}-incomplete
> rsync -avP --exclude-from=/etc/rsync/web-exclude --link-dest=/nas/web-backup/Backups/current /nas/web/ /nas/web-backup/Backups/${date}-incomplete
> 
> mv /nas/web-backup/Backups/${date}-incomplete /nas/web-backup/Backups/${date}
> chown -R www-data:www-data /nas/web-backup/Backups/${date}
> 
> cd /nas/web-backup/Backups
> rm /nas/web-backup/Backups/current
> ln -s ${date} current
> unset date
> 
> # delete backups created more than 7 days ago
> find /nas/web-backup/Backups/ -maxdepth 1 -ctime +6 -exec rm -rf {} \;

-- 
Wilcox-McCandlish Law of Online Discourse Evolution:
The chance of success of any attempt to change the topic or direction of
a thread of discussion in a networked forum is directly proportional to
the quality of the current content.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html




More information about the Linux-il mailing list