Backup - Tape or CD-R

Glenn Burkhardt glenn at aoi.ultranet.com
Thu Jan 11 21:53:59 GMT 2001


> I am setting up a new PC/Linux/samba server for a small office (damn
> lawyers) and I want to be able to automate backup of data on the Samba
> shares. I will need to backup approximately 100M of data for a complete
> backup with 25M incremental backups during the week. I would like for
> the server to handle this process if possible instead of having a Win98
> client assume the chore. With that background, I have two questions:

We use a Linux box to back up our small office each night.  We have Sun
systems, Linux systems, Win95, Win98, and WinNT systems.  The Linux box
has a SCSI controller, with a DDS-3 tape drive connected (12gb raw; drive
compresses data on the fly, so the actual capacity is much higher).

Attached is the script I use for the WinXX systems.  It creates multiple tar
files on the tape.  It gets run by 'cron' during the wee hours of the night.

One warning - the released version of smbclient screws up if a file is made
bigger on the WinXX system during the network file copy.  For example, if email
arrives and is appended to a mailbox, while smbclient is accessing the file,
the resulting tar file will be unusable.  Attached is a patch for that problem.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbtar.patch
Type: application/x-patch
Size: 852 bytes
Desc: smbtar.patch
Url : http://lists.samba.org/archive/samba/attachments/20010111/d01059a0/smbtar.bin
-------------- next part --------------
#! /bin/bash
if [ $# = 0 ] ; then
    fileno=0
else
    fileno=$1
fi

SMBC=/usr/local/samba/bin/smbclient
cd /root/backup
TAPE=/dev/nst0

FAILED_MSG="\
Backups were not done this evening because your machine is not available on\n\
the network.  Please be sure to leave your machine on each night so backups\n\
can be done.  Thank you!"

EXCLUDE='windows winnt dos xnfs orcadwin MAXPLUS2 emacs OmniX OmniNFSXe \
    MSOffice Office wpwin60 Acrobat3 engr wpc20 DMI ATI PAGEMGR KPCMS OPLIMIT \
    wpwin60 dell mouse vibra16 teac winmcad win32app acroread acrobat3 \
    bsdl pkware ACADR13 DTEXT23 MCVHDL RECYCLED lotus Corel Eudora/eudora.log \
    ACER MAX2WORK ticd abel3 clipart HPFONTS ORCADWIN ICM98 OrCad2 gs \
	ALLIED99 CKWIN7 gstools PSFONTS synplicity WINPROJ'

#  Hosts with full access to shares with <PASSWORD> 
#
# 
blAppend()
{
    n=${#hlist[*]}	# appednd to host list
    hlist[$n]=$1

    n=${#slist[*]}	# append to share list
    slist[$n]=$2

    n=${#olist[*]}	# append to owner email name list 
    olist[$n]=$3
}

# Build list of 
#         host   share user-to-notify
blAppend drachma   C    sandra
blAppend kopek     C    johnf
blAppend masada    C    mike
blAppend vishnu    C    maureen
blAppend aries     C    laura
blAppend fujin     C    jim
blAppend fujin     D    jim
blAppend pellinore C    ellen
blAppend sappho    C    dolores
blAppend diana     C    pbm
blAppend osimo     C    yvan

i=0
while [ $i -lt ${#hlist[*]} ] ; do
    echo
    date
    echo ping ${hlist[$i]}
    ping -c 1 ${hlist[$i]}
    if [ $? != 0 ] ; then
      echo email to ${olist[$i]} for ${hlist[$i]} not available
      echo $FAILED_MSG | mail -s "Backup for ${hlist[$i]} failed" ${olist[$i]}
      echo $FAILED_MSG | mail -s "Backup for ${hlist[$i]} (${olist[$i]}) failed" backuplist
    else
      echo File ${fileno}: ${hlist[$i]}
      $SMBC \\\\${hlist[$i]}\\${slist[$i]} "PASSWORD" -TcbX 126 $TAPE \
	    	"Program Files" $EXCLUDE &> ${hlist[$i]}-${slist[$i]}.log

      fileno=$(($fileno + 1))
    fi
    i=$(($i + 1))
done

echo "PC backups complete"
date


More information about the samba mailing list