Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2001 10:46:40 -0400
From:      Jim Arnold <jim@ohio.com>
To:        jacks@sage-american.com, freebsd-questions@freebsd.org
Subject:   Re: FS backup to Hard Disk
Message-ID:  <a05100332b7cd06bbf789@[206.128.102.10]>
In-Reply-To: <3.0.5.32.20010917211717.06b79c98@mail.sage-american.com>
References:  <3.0.5.32.20010917211717.06b79c98@mail.sage-american.com>

next in thread | previous in thread | raw e-mail | index | archive | help

I use the little program below on my box. it's a server with
a drive dedicated to just backing up the main disk. it's easy and 
works very well.

jim

==========
#!/bin/sh
# full and incr backup script
# created 27 Sep 99
# Based on a script by Daniel O'Callaghan <danny@freebsd.org>

#Change the 5 variables below to fit your computer/backup

COMPUTER=hogan                 # name of this computer
DIRECTORIES="/etc /www /usr/local /var/named /var/log" 
# directoris to backup
BACKUPDIR=/deskstar/backups         # where to store the backups
TIMEDIR=/deskstar/backups/last-full # where to store time of full backup
TAR=/bin/tar                      # name and locaction of tar

#You should not have to change anything below here

PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a`              # Day of the week e.g. Mon
DOM=`date +%d`              # Date of the Month e.g. 27
DM=`date +%d%b`             # Date and Month e.g. 27Sep

# On the 1st of the month a permanet full backup is made
# Every Sunday a full backup is made - overwriting last Sundays backup
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last weeks incremental backup of the same name.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.

                
if [ $DOM = "01" ]; then  # monthly full backup
         NEWER=""
         $TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DM.tgz $DIRECTORIES
fi

if [ $DOW = "Sun" ]; then # weekly full backup
         NEWER=""
         NOW=`date +%d-%b` 
         echo $NOW > $TIMEDIR/$COMPUTER-full-date #update full backup date
         $TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DOW.tgz $DIRECTORIES

else    #make incremental backup - overwrite last weeks
         NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`" #get date 
of last full backup
         $TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DOW.tgz $DIRECTORIES
fi

=========


>I would like to do nitely cron backup everything for full restore to a
>second hard disk:
>/mnt/fat32/backupdir
>
>I gather I need to use "tar" to do this, but not exactly sure of the
>precise command and switches. Don't want to mess up on this. Here's my fstab:
>
>Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
>/dev/ad0s2a     99183    29641    61608    32%    /
>/dev/ad0s2f   8835083   673328  7454949     8%    /usr
>/dev/ad0s2e     19815     2317    15913    13%    /var
>procfs              4        4        0   100%    /proc
>/dev/ad1s1   13264736  3086024 10178712    23%    /mnt/fat32
>
>Guidance on exact tar line command would be appreciated.... thanks in
>advance.
>
>Best regards,
>Jack L. Stone,
>Server Admin
>
>Sage-American
>http://www.sage-american.com
>jacks@sage-american.com
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message


-- 

___________________________________________________________
Jim Arnold  <jarnold@knightridder.com>	Voice: 330.253.9524 x 9-12
Ohio.com Site Administrator		Fax: 330.253.8214
http://www.ohio.com              		Cell: 330.730.0797
AOL IM: instantjim

12 E. Exchange Street - 2nd Fl -- Akron, OH 44308


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a05100332b7cd06bbf789>