From owner-freebsd-questions Mon Apr 17 10:03:59 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA08182 for questions-outgoing; Mon, 17 Apr 1995 10:03:59 -0700 Received: from netcom11.netcom.com (pascal@netcom11.netcom.com [192.100.81.121]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id KAA08173 for ; Mon, 17 Apr 1995 10:03:58 -0700 Received: by netcom11.netcom.com (8.6.12/Netcom) id KAA14764; Mon, 17 Apr 1995 10:03:44 -0700 Date: Mon, 17 Apr 1995 10:03:44 -0700 From: pascal@netcom.com (Richard A Childers) Message-Id: <199504171703.KAA14764@netcom11.netcom.com> To: questions@FreeBSD.org Subject: trivial backup script Sender: questions-owner@FreeBSD.org Precedence: bulk After a few requests for the backup script in question, I've decided to post it for the use of those whom find it useful or a good starting place for their own backup script(s). A little bit of descriptive overview : (1) define some useful variables that will prove useful in labelling the tape ( see ft(1) ) and dump log with hostname, day, and time (2) create the backup image using your favorite utility and command- line flags (3) use the utility to verify the image - tar(1) is better at this that dump(8) or restore(8), but for system backups you probably don't want to use use tar(1) or cpio(1) (4) use dd(1) to verify the media upon which the image is stored That's it. Nothing complicated ... just methodical. ===== cut here ===== #!/bin/csh -f set HOST = `hostname` # helpful w/ multiple systems or tapes set ROOT = "/home/childers" # this should be an absolute path set LOGDIR = "${ROOT}/Backups" # you will need to make this directory set STAMP = `date +%y%m%d@%H%M` # day-time-stamp to be used in logfile # should note when backup was started, to calculate lapse # echo "backup of ${ROOT} started at `date` ..." # cd to top of hierarchy to be backed up # cd ${ROOT} echo " writing backup tape of ${ROOT} ..." ########################################################################### # # if you want dump(8) you'll need to replace this : # # "^tar cbf 512k - ." # # ... with something like this : # # "^dump 0sdbf 305 5000 512 - /dev/rsd0a" # # ... where "305", "5000" and "512" are experimentally # derived values which will not be defended here and now. # ########################################################################### # # create tar tape # tar cbf 512k - . | ft "${HOST}:${ROOT} tar at ${STAMP}" echo " creating table-of-contents from backup ..." ########################################################################### # # for compatibility with the above change, you'll need to replace : # # "tar tvbf 512k -" # # ... with # # "restore -tvbf 512 -" # # ... # ########################################################################### # # re-read tar tape to insure readability # ft | tar tvbf 512k - >& ${LOGDIR}/${STAMP}_tar.toc echo " scanning backup tape for defects ..." # reread media to insure freedom from defencts # ft | dd bs=512k of=/dev/null |& tee -i ${LOGDIR}/${STAMP}_dd.log echo "backup finished at `date`" exit # # that's all, folks !! # ===== cut here ===== -- richard Good faith : see "Legal Fiction". Legal fiction : see "Good Faith". richard childers san francisco, california pascal@netcom.com