If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
From - Wed Aug 9 07:06:17 2000
Path: news.randori.com!news-feeder2.wcg.net!WCG!news.telstra.net.nz!skynet.be!newsfeed.mathworks.com!cyclone.swbell.net!nnrp2.sbc.net.POSTED!not-for-mail
Message-ID: <399098ED.2EBE4394@worldnet.att.net>
From: Steve Fabac <smfabac@worldnet.att.net>
Organization: S.M. Fabac & Associates
X-Mailer: Mozilla 4.08 [en]C-WNS2.5 (Win16; U)
MIME-Version: 1.0
Newsgroups: comp.unix.sco.misc
Subject: Re: Newbie needs backup help
References: <39923467.0@windy.powercom.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 360
Date: Wed, 09 Aug 2000 00:34:05 +0100
NNTP-Posting-Host: 208.190.202.99
X-Complaints-To: abuse@swbell.net
X-Trace: nnrp2.sbc.net 965799254 208.190.202.99 (Wed, 09 Aug 2000 00:34:14 CDT)
NNTP-Posting-Date: Wed, 09 Aug 2000 00:34:14 CDT
Xref: news.randori.com comp.unix.sco.misc:64254
X-Mozilla-Status: 8010
X-Mozilla-Status2: 00000000
Waif W. Urchin wrote:
>
> Running SCO OS Enterprise 5.0.5 fully patched.
> 2 SCSI HDD - 4.5GB each
> 1 Tandberg 4GB/8GB SCSI Tape drive
>
> If you need more detail for this question, please let me know.
>
> Being an overworked programmer, I have approximately .5 minutes per week to
> spend on administration, and as such, have spotty knowledge of very specific
> administrative areas at best. But I am interested in learning. So please,
> be gentle. And in the spirit of learning something new this week, I would
> like to create a simple backup solution that does not rely on a commercial
> product like Lone-Tar or Cheyenne.
>
> We are not a dynamic company, we do not run 24/7, and we do not host any
> processes that need to run 24/7 (web server, ftp, etc.) - so backing up the
> system at night and assuming nothing will change from start to completion of
> the backup works fine for us.
>
> Presently, I have a cron job set to backup our /u information (the main
> systems) as follows:
>
> 0 20 * * 1-5 find /u -depth -mount -print |
> cpio -oHcrcBv -C10240 -K8000000 -O /dev/rct0
>
> I'm sure this isn't the best way to do this, but I also know this works, so
> I haven't dug much further into optimizing it. I also realize this method
> doesn't save the SCO system files, but I figured I could spend a couple
> hours reinstalling SCO in case of a catastrophy (which hasn't happened yet
> (knock on poly-laminate)). Of course, a method that allows me to store
> these files would be nice however.
>
> I recently added a second hard drive to the server. We have moved a fair
> amount of the user's data to this second drive and I have some development
> projects running on it (nothing critical to the company at the moment). The
> second drive is /u2 from root. With this new drive, the amount of data I
> need to backup has increased to about 6GB instead of the 3.5GB we had
> before.
>
> How do I:
>
> 1). Change the backup to include this new drive as well as the old.
> 2). Get the contents to fit on a 4GB tape (I assume dd or some tar variant)
> or get the tape drive to switch to compressed "mode" to allow 8GB of stuff
> to be saved.
>
> My absolute dream would be to have a cron job that backs up the entire
> system (SCO files and all) to my 8GB tape with the ability to restore a
> single file to a user specified directory.
>
> TIA
>
> Urchin
A lot of folks on this news group will eschew any home grown backup
solution in favor of BRU, Loantar, Backup Edge, etc.., but you can
build a reliable script using cpio. The following is a mail message
from by home-grown script that I install on all my client's servers.
> Message 443:
> From Backup Thu Jun 15 22:02:03 CDT 2000
> To: admin
> Subject: Nightly Backup Status
> Status: RO
>
> Start CPIO tape write: Thu Jun 15 22:19:46 CDT 2000
> CPIO: can't open /dev/tty for writing.
>
> status : ready beginning-of-tape
> soft errors : 0
> hard errors : 0
> underruns : 0
> status : ready beginning-of-tape
> Total read errors corrected : 0
> Total read ECC errors : 0
> Total bytes transferred (read) : 10617
> Total unrecovered read errors : 0
> Total write errors corrected : 0
> Total write ECC errors : 0
> Total bytes transferred (write) : 3853
> Total unrecovered write errors : 0
>
> Tape size specified: 4000000k
> Path specified: ./ (root)
>
> last or current transfer: 4000000k
>
> / : Disk space: 1439.22 MB of 2047.99 MB available (70.27%).
> /stand : Disk space: 8.21 MB of 20.00 MB available (41.06%).
> /u : Disk space: 1236.39 MB of 2047.99 MB available (60.37%).
> /lisec : Disk space: 2249.34 MB of 3097.22 MB available (72.62%).
> /oracle : Disk space: 1544.22 MB of 3097.22 MB available (49.86%).
> /tmp : Disk space: 413.21 MB of 501.54 MB available (82.39%).
>
> Total Disk Space: 7852.62 MB of 15087.93 MB available (52.05%).
>
> Check tape readability with dtype:
> /dev/rct0 : cpio old character format
>
> Starting Verify Thu Jun 15 22:44:46 CDT 2000
>
> VERIFY: 29716 Files Verified OK!
> VERIFY: 1 Files with checksum and mtime changed!
> VERIFY: 0 Files missing from tape!
> VERIFY: 0 Files failing verify!
> VERIFY: 29717 Total files scanned from /tmp/BACKLIST!
> GREP: 84106 Total real files in /tmp/BACKLIST!
>
> BACKUP FAILED:
> WARNING: Real files in /tmp/BACKLIST exceeded the verify count by 54389 files!
>
> :Check the tape size specified and the amount of the last transfer listed
> :above. If they are equal then this backup has exceeded the size of the tape.
> :If you see tape write error() error 5, then either your tape media is bad
> :or your tape drive needs cleaning.
>
> Backup completed Thu Jun 15 23:08:14 CDT 2000 1:6:11
The above backup failed as this was a new server installation with
a new DDS3 tape drive and the TAPE SIZE specified had not been changed
from 4G to 12G. Once cpio got to the 4G tape size specified, it
stopped writing the backup. The message "CPIO: can't open /dev/tty for
writing." is the standard error when a cpio is run from cron.
Several neat ideas are shown in the above report:
1) logs the time each operation starts and displays the total time to
complete the backup "one hour, 6 minutes, 11 seconds."
2) writes a standard "mail" file that can be read as mail -f bu.log.
And can send the report to any email address.
3) prints a report to the default system printer or to a
printer specified in /prt. (Also cancels the print job if the
report is
over 5 pages. This usually results from files with CR in their
names, causing the script that verifies the checksum to get out
of sync.)
4) lists any file where the checksum calculated for the file on-disk
(stored in the /tmp/BACKLIST source file) is different from the
checksum calculated in the tape verify pass and the file size,
and modification time on tape is the same as the file on disk.
5) Creates /tmp/BACKLIST containing a cpio -icvnt listing of all
files to be backed up and writes tmp/BACKLIST as the first file
on the backup tape.
6) Uses the cpio -n function to generate a checksum of the on-disk
file and stores it in /tmp/BACKLIST. Then the verify pass reads
the tape created and uses the cpio -n function to calculate the
checksum of the file as read from the tape
7) Backs up all files from / as ./ so that the tape can be restored
to /mnt when booted from emergency boot floppy and dumping to a
new disk where /dev/hd0root is mounted on /mnt
8) If called as bu, backs up all files from ./ if called as
"bu /u", or "bu /u/data", then backs up only files in ./u
or ./u/data.
9) Backs up files with spaces in the name or subdirectory name
(but fails when a file name is created with a trailing space).
10) Tests to see if the tape drive is loaded, that the tape is not
write protected, and retensions the tape prior to writing to it.
(Note that the Sony SDT7000, 9000, 10000 are the only DAT drives
that I know respect the tape reten command.)
My script is not perfect, it does not backup and restore sparse files,
The use of cpio to generate the /tmp/BACKUP list is computational
intensive and can take significatn amount of time on a large system.
The time to restore the last file from the tape is nearly identical to
the time requried to verify the tape, there is no fast seek capability
in cpio. The checksum stored in /tmp/BACKLIST is a snapshot of the file
as it existed when /tmp/BACKLIST was created. By the time the file is
read from the disk and written to tape, active processes may have
modified the file causing the checksum and modification time of the
on-disk file to change. Therefor any "changed" file cannot be considered
as "verified"
Note: the following is not a complete listing of the bu script.
The items shown illustrate important points in assembling the
/tmp/BACKLIST file and verifying the tape.
:
# @(#) bu 1.7ahlv1.2 10/26/99
#
# Copyright (C) S.M. Fabac & Associates, 1994, 1995, 1996, 1997, 1998,
1999
# This Module contains Proprietary Information of
# S.M. Fabac & Associates and should be treated as Confidential.
#
> /tmp/$$
echo $$ > /usr/spool/tape/bu.pid
doreten=`basename $0`
cd /
# Reten used for DC600 cart's and Sony SDT7000
# Reten moved to /usr/bin/bushell
[ "$doreten" = "bu" ] && {
tape reten > /dev/null 2>&1 &
sleep 3
}
date +'%a %h %d %T %Z %Y' > /usr/adm/bu.err
# marker file to satisfy bu script for header generation - needed since
changing
# from cat /tmp/BACKLIST to awk /tmp/BACKLIST
date +'cpio: marker file:"%a %h %d %T %Z %Y": marker (error 2)' >>
/usr/adm/bu.err
date +'%a %h %d %T %Z %Y' > /tmp/BACKLIST
#
TAPEBUSY=`fuser /dev/xct0 2>&1 | awk ' { print $2 } ' `
[ "$TAPEBUSY" -gt "" ] || {
CHECKTAPE=`tape status | awk ' /status
:$|offline|off-line|write-protected|empty/ { print "NOTAPE" } ' `
}
TAPESTATUS=${CHECKTAPE:-OK}
# Set printer for Logging reports
[ -f /prt ] && LOGPRINTER="-d"`cat /prt `
# Get the files to be backed up: put /tmp/BACKLIST at the beginning of
the tape!
find ./tmp/BACKLIST -print | cpio -oca | cpio -icnvt >> /tmp/BACKLIST
[ "$TAPESTATUS" = "OK" ] && {
find .$1 -print | sed -e '/etc\/ptest/d' -e '/tmp.BACKLIST/d' -e
'/var.adm.bu.err/d'| cpio -oca | cpio -icnvt >> /tmp/BACKLIST
find ./etc -name ptest -print | sed -e '/tmp.BACKLIST/d'| cpio -oca |
cpio -icnvt >> /tmp/BACKLIST
} || echo "Tape Status: = $TAPESTATUS" >> /tmp/BACKLIST
[ "$TAPESTATUS" = "OK" ] && {
awk ' {
if ( NF == 9 ) print $9
if ( NF > 9 && $10 == "->" ) print $9
if ( NF > 9 && $10 != "->" ) {
st=index($0, $9)
printf "%s\n", substr($0, st)
}
} ' /tmp/BACKLIST | cpio -ocva -K $SIZE -C 10240 -O /dev/rct0 >>
/usr/adm/bu.err 2>&1
# House Keeping
# Some of the following commands may need to be commented out for
# SCSI tape systems
echo "\n\n" >> /usr/adm/bu.err
tape -s status >> /usr/adm/bu.err
tape -s xstatus >> /usr/adm/bu.err 2>/dev/null
stuff deleted
echo "\nCheck tape readability with dtype:" >> /usr/adm/bu.err
dtype /dev/rct0 >> /usr/adm/bu.err 2>&1
} || {
sleep 10
}
CHECKTAPE=`tape status | awk ' /status
:$|offline|off-line|write-protected|empty/ { print "NOTAPE" } ' `
TAPESTATUS=${CHECKTAPE:-OK}
[ "$TAPESTATUS" = "OK" ] && {
echo 'Starting Verify ' `date +'%a %h %d %T %Z %Y'` "\n">>
/usr/adm/bu.err 2>&1
#CRC VERIFY Open Server 5.0.x:
cpio -icnvtk -I /dev/rct0 | awk ' BEGIN {
files = 0
mfiles = 0
}
{ count+= 1
checksum = $1
filename = $9
while ( getline bob < "/tmp/BACKLIST" > 0 ) {
a[1] = 0
split(bob, a)
if ( a[9] == "tmp/BACKLIST" ) {
while ( $9 != "tmp/BACKLIST" )
getline
count+= 1
}
if ( a[9] == $9 ) break
if ( NR > 1 ) {
print "ATTENTION: File in BACKLIST but not on tape: "
print bob
print ""
missfile+= 1
}
}
if ( $1 != 0 ) {
Bcount+= 1
if ( $1 != a[1] ) {
if ( $4 == a[4] && $5 == a[5] && $6 == a[6] && $7 == a[7] && $8
== a[8] ) {
print "Verify FAILED?: <Tape ", $1, " List> ", a[1], $9
print "CHECK: <Tape ", $4, $5, $6, $7, $8, " List> ", a[4], a[5], a[6],
a[7], a[8]
print ""
filefail+= 1
}
else
mfiles+= 1
}
else
files+= 1
}
} END {
printf "VERIFY: %8d Files Verified OK!\n", files
printf "VERIFY: %8d Files with checksum and mtime changed!\n", mfiles
printf "VERIFY: %8d Files missing from tape!\n", missfile
printf "VERIFY: %8d Files failing verify!\n", filefail
printf "VERIFY: %8d Total files scanned from /tmp/BACKLIST!\n", Bcount
+ missfile
}' | tee /tmp/$$ >> /usr/adm/bu.err 2>&1
grep -c -v "^00000" /tmp/BACKLIST | awk ' {
printf "GREP: %10d Total real files in /tmp/BACKLIST!\n", $1 - 1
} '| tee -a /tmp/$$ >> /usr/adm/bu.err 2>&1
awk ' /VERIFY:/,/GREP:/ {
if ( $1 == "VERIFY:" && $3 == "Total" ) scan_count = $2
if ( $1 == "GREP:" && $3 == "Total" ) grep_count = $2
} END {
if ( grep_count > scan_count ) printf "\nBACKUP FAILED:\nWARNING: Real
files in /tmp/BACKLIST exceeded the verify count by %s files!\n\n:Check
the tape size specified and the amount of the last transfer
listed\n:above. If they are equal then this backup has exceeded the size
of the tape.\n:If you see tape write error() error 5, then either your
tape media is bad\n:or your tape drive needs cleaning.\n", grep_count -
scan_count
} ' /tmp/$$ >> /usr/adm/bu.err
}
Stuff deleted
tape unload
## IF you want mail notification, uncomment the following and change the
## e-mail addresses as necessary
#awk '/Start CPIO/,/Backup completed/ { print $0 } ' /tmp/$$ >
/tmp/mail$$
#mail -s "Nightly Backup Status"
smfabac@att.net,elrodk@email.MRA_EMAIL_SERVER,root < /tmp/mail$$
rm /tmp/$$ /tmp/mail$$
#
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 5 | 19 | 28 | 28 | 5,454 |
/Bofcusm/470.html copyright 1997-2004 (various authors) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Click here to add your comments