DATMAN TECHNICAL BULLETIN #038
From: Kan Yabumoto tech@datman.com
To: DATMAN user
Subject: A full backup script (batch file) for AutoLoader
Date: 2000-02-16
====================================================================
Alternative to Tape-Spanning.
Although the DATMAN-PRO software supports some popular Autoloaders
(HP and Seagate's models), it does not have the so-called
"tape-spanning" feature which treats multiple tapes as a one
combined volume. This causes some headache in writing a good
backup script (batch file). If you have many hard disk volumes
and partitions, the job gets even messier.
A common approach is to separate the entire volumes of the hard
disks into manageable parts which will be backed up by each of the
available tape cartriges in the autoloader drive.
For example, you may break up your C: and D: drive as follows:
Tape 1: C:\windows
Tape 2: C:\Program Files
Tape 3: C:\MSOffice
Tape 4: C:\My Document
Tape 5: Other directories in C:
Tape 6: D:\
As you can see, this over-simplified partition scheme would
make a very uneven split. It would result in much wasted space
in some tape. Moreover, if you make finer separation, some
tape may run out of space in the future. At best, such a scheme
would not adapt to the dynamic environment of constantly evolving
hard disk contents.
Yes, the tape-spanning scheme will solve this problem nicely.
But, we don't have it yet...
Fill up a tape before switching to the next.
This situation is very similar to a classic case of copying a
directory into diskettes. When the total amount of data exceeds
the capacity of one diskette, you need to use many diskttes and
you want to do it using a simple batch file.
One simple way is to set the Archive bit of the files in the
directory you are going to save to the diskettes, first. And
then, use "XCOPY /M" to perform an "incremental backup". The
Archive bit of a file will be cleared as soon as the file is
successfully copied. When a diskette becomes full, the XCOPY
operation will fail. By inserting a new diskette and repeating
the same XCOPY command will skip the files which has been copied
by focusing only on the files which as the Archive bit still
set.
We will use this old technique to a full system backup using the
Autoloader. After all, DATMAN-PRO has full control over the
autoloader-function it is ideal for unattended system backup.
But, if you attempt to use Microsoft's ATTRIB utility to set
the Archive bit on the files in the entire C: drive, you will
encounter a problem. See related article XXCOPY -- XXTB #06.
Our "XXCOPY /AA" will do the job right.
The Four stage Full Backup:
1. Set the Archive attribute bit of every file in the system.
2. Format the tapes in the Autoloader and mount Tape 1.
3. Run the "Incremental backup" script on the current tape.
4. When the backup terminates by the out-of-space condition,
load the next tape and repeat Step 3.
Here, the incremental backup always tries to copy all the volumes
in the system using "XXCOPY /M" method which skips the files which
have been saved earlier.
FULLBACK.BAT ; the main backup batch file
COPYALL.BAT ; a batch file called by FULLBACK.BAT
EXCLUDE.LST ; XXCOPY exclusion file (referenced by COPYALL.BAT)
Note: It is assumed that these files are stored in "c:\datman\".
To improve readability, a double-colon (::) is used as
the prefix of comment field in both the batch file and the
xxcopy Exclude file (the :: sequence is legal in the files
and you may leave them).
FULLBACK.BAT (the main backup script which calls COPYALL.BAT)
:: First stage ----------------------------------------------------
:: set archive bits to all files in all drives
xxcopy c:\ /s /aa /q2
xxcopy d:\ /s /aa /q2
xxcopy e:\ /s /aa /q2
xxcopy f:\ /s /aa /q2
:: Second stage ---------------------------------------------------
:: format all six tapes
datmania u: alload 1
if not errorlevel 1 goto end
if errorlevel 2 goto end
datmania u: format backup1 "This is full backup tape #1"
datmania u: alload 2
if not errorlevel 2 goto end
if errorlevel 3 goto end
datmania u: format backup2 "This is full backup tape #2"
datmania u: alload 3
if not errorlevel 3 goto end
if errorlevel 4 goto end
datmania u: format backup3 "This is full backup tape #3"
datmania u: alload 4
if not errorlevel 4 goto end
if errorlevel 5 goto end
datmania u: format backup4 "This is full backup tape #4"
datmania u: alload 5
if not errorlevel 5 goto end
if errorlevel 6 goto end
datmania u: format backup5 "This is full backup tape #5"
datmania u: alload 6
if not errorlevel 6 goto end
if errorlevel 7 goto end
datmania u: format backup6 "This is full backup tape #6"
:: Third stage ---------------------------------------------------
:: use tape 1 and do the backup as much as possible
datmania u: alload 1
if not errorlevel 1 goto end
if errorlevel 2 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:: use tape 2 and do the backup as much as possible
datmania u: alload 2
if not errorlevel 2 goto end
if errorlevel 3 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:: use tape 3 and do the backup as much as possible
datmania u: alload 3
if not errorlevel 3 goto end
if errorlevel 4 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:: use tape 4 and do the backup as much as possible
datmania u: alload 4
if not errorlevel 4 goto end
if errorlevel 5 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:: use tape 5 and do the backup as much as possible
datmania u: alload 5
if not errorlevel 5 goto end
if errorlevel 6 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:: use tape 6 and do the backup as much as possible
datmania u: alload 6
if not errorlevel 6 goto end
if errorlevel 7 goto end
datmania u: mount
if errorlevel 2 goto end
call copyall.bat
:end
EXCLUDE.LST (provides a list of files and directories to exclude)
:: This file specifies exclusion list for xxcopy.
:: If no drive letter is assigned, it applies to the target drive.
::
win386.swp :: swap file is always waste of time
*.tmp :: temporary garbage anywhere
\recycled\ :: this is a useless directory in all volume
\temp\ :: many people have this
\windows\temp*\
c:\datman\shadow\
c:\netscape\cache\ :: whatever your browser uses for cache
COPYALL.BAT (copies files which have not yet been archived)
:: datmania will return 2 if the T: drive has no space left.
datmania t: mount
if errorlevel 2 goto end
:: incremental backup of Drive C to the tape volume --------------
xxcopy c:\ t:\backupc\ /m/i/e/y/ks/r/h/exc:\datman\exclude.lst
datmania t:
if errorlevel 2 goto end
:: remove unnecessary part below...
:: incremental backup of Drive D to the tape volume --------------
xxcopy d:\ t:\backupd\ /m/i/e/y/ks/r/h/exc:\datman\exclude.lst
datmania t:
if errorlevel 2 goto end
:: incremental backup of Drive E to the tape volume --------------
xxcopy e:\ t:\backupe\ /m/i/e/y/ks/r/h/exc:\datman\exclude.lst
datmania t:
if errorlevel 2 goto end
:: incremental backup of Drive F to the tape volume --------------
xxcopy f:\ t:\backupef /m/i/e/y/ks/r/h/exc:\datman\exclude.lst
datmania t:
if errorlevel 2 goto end
:: here, add more drive(s) if you have more...
:end