Backup script (was Re: rsync problem)

2011-03-21 Thread sammy ominsky
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=20 --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 {} \;


--sambo
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Backup script (was Re: rsync problem)

2011-03-21 Thread Omer Zak
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=20 --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


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Backup script (was Re: rsync problem)

2011-03-21 Thread sammy ominsky
Actually, with the possibility of nfs, my data could be anywhere and just 
mounted at /nas/web-backup :)

Also, the --link-dest= flag I use is the hard link snapshots you're asking 
about.  It creates a new generation of links each day, and keeps a rotating 
week of them.  It's not N backups, it's N generations of hard links.

sambo


On 22/03/2011, at 00:23, Omer Zak wrote:

 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=20 --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
 
 
 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Backup script (was Re: rsync problem)

2011-03-21 Thread Mike Miller
On Tue, Mar 22, 2011 at 06:23, Omer Zak w...@zak.co.il wrote:
 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?

You can start with http://www.mikerubel.org/computers/rsync_snapshots/

You may also find http://www.rsnapshot.org/ to be of interest.

-- Mike

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il