Custom Script for Travan/miniQIC Tape Backups

Discussion in 'Windows Small Business Server' started by Owen Williams, Sep 25, 2004.

  1. FIRST, A MODEST REQUEST: I fully understand that Travan/miniQIC drives
    are not the best backup devices and are thought by many to deserve a
    place among the damned. Notwithstanding, many of our clients have them.
    What follows is my attempt to help those of you who ALREADY support
    Travan/miniQIC backup devices make the best of them. I do NOT recommend
    them if you are selecting a NEW backup device. So please: No flames by
    those who hate these devices. Thanks!

    DISCLAIMER: What follows reflects my experiences. It works for me but
    you should thoroughly test it to make sure it will work for you.

    MY STORY: One of my clients has a Seagate STT3401A (IDE Travan
    20GB/40GB) streaming drive for SBS2003 backup. Initially, backup
    success (backup + successful verify) with this drive was only 14% -
    totally unacceptable. A call to the vendor (Dell) determined it was
    likely that [1] the drive was bad and/or [2] the drive microcode was
    corrupt or at least needed to be updated. Vendor shipped new drive,
    which I installed, and also provided the latest microcode, which was
    updated without incident.

    Problem was, after the swap and microcode update, drive was identified
    as a miniQIC, not Travan. Applying the patch from Microsoft Knowledge
    Base Article 831664 did NOT fix this. Thus, the wizard-based SBS2003
    backup would not work at all. Using a variety of resources - magazines,
    this and other newsgroups, and lots of web searches - I built the
    following custom backup script which works with this drive as a miniQIC
    and will probably work (with some modifications) with others.

    BOTTOM LINE: Backup success is now greater than 95%. I have also run
    test restores, which worked fine.

    [1] The script includes an optional "trace" function which helps
    diagnose failures.
    [2] The Sleep command is available in pretty much any Windows Resource
    Kit. Any comparable command which waits a specified number of seconds
    can be used instead.
    [3] I included some steps in the script to improve the probability of
    success with a Travan/miniQIC streaming drive, such as retensioning the
    tape before performing the backup and ejecting it afterward.
    [4] The NTBackup command is explicitly specified in the script, not
    generated by SBS BackupRunner, so you have VERY granular control over
    all the options.
    [5] SBS2003 Server Management Backup thinks no backup is being run and
    will therefore NOT display backup results. The script e-mails the
    summary backup log to anyone specified (see script for details) and any
    number of logs can be retained for later review. (Server Management
    Backup retains backup results as an XML file. Perhaps someone with more
    XML programming knowledge - and time on their hands - than I have will
    enhance the script to properly update that file.)

    CAUTION: Longer command lines are wrapped by newsreader; examine
    carefully and unwrap them to make a working script.

    @Echo off
    :: Windows Small Business Server 2003 Full Backup to IDE Travan tape
    :: drive script
    :: Author: Owen Williams, ClearView Technology Consulting
    :: As Of: 02 Sep 2004
    :: - - - - - - - - - -
    :: NOTE: This script should be scheduled using the Windows Scheduled
    :: Tasks applet (Start | All Programs | Accessories | System Tools |
    :: Scheduled Tasks). Do NOT schedule SBS backups using the NTBackup
    :: scheduler. The script should be run using an account which has full
    :: Administrator privileges. (Backup Operator privileges may work but
    :: have not been tested.)
    :: More information about backup batch files is available from the
    :: Microsoft reference article in Technet Q239892 "How to Schedule
    :: Unattended Backups Using a Stand-Alone Tape Library"
    :: - - - - - - - - - -
    Set Trace=Yes
    :: Set DateDay environment variable to the current date & day, e.g.,
    :: 20040526-Wed
    For /F "Tokens=1-4 Delims=/ " %%i In ('Date /T') Do Set DateDay=%%l%%j%%
    If %Trace%==Yes Echo Backup Trace for %DateDay% >"%SBSProgramDir%\Backup
    :: Use the Removable Storage Manager to refresh removable storage media
    :: and wait 120 seconds to allow refresh to complete. Low-cost IDE
    :: drives often do not notify removable storage that a tape has been
    :: loaded. The refresh command queries the drive for any changes.
    :: NOTE: The Name of the device to be refreshed is aquired by typing:
    :: RSM View /Tlibrary
    :: at a command line and selecting the correct device name.
    If %Trace%==Yes Echo RSM Refresh >>"%SBSProgramDir%\Backup\Trace.log"
    RSM Refresh /LF"Seagate STT3401A"
    Sleep 120
    :: Retension the tape, waiting until the retension completes before
    :: proceeding. This is an important step when using Travan and similar
    :: streaming drives to minimize media errors. Freeware utility
    :: TapeUtil.exe is available from Bill Stewart's web site:
    :: Usage: TapeUtil -r [drive#]
    :: -r Retension the media in the drive.
    :: [drive#] Number of the tape drive, numbered 0 through 9.
    :: (The utility has other functions; only retension is used in this
    :: script.)
    If %Trace%==Yes (
    TapeUtil -r 0 >>"%SBSProgramDir%\Backup\Trace.log"
    ) Else TapeUtil -r 0
    Echo TapeUtil Return Code: %ErrorLevel% >>"%SBSProgramDir%\Backup
    :: Backup the folders/files specified in @[path to .BKS] [Create the
    :: .BKS file using the SBS 2003 Backup Wizard. Then, re-run the Wizard
    :: and disable the automated SBS backup processing. NOTE that you will
    :: need to manually disable Exchange circular logging since the SBS
    :: Backup Configuration Wizard believes no backup is being performed.]
    :: - use the Normal (full backup with reset of archive bit) method (/M)
    :: - backup from a volume shadow copy (/SNAP:eek:n)
    :: - do not backup the Removable Storage Database (/RS:no)
    :: - backup to the miniQIC drive (/P "miniQIC") [Use "Travan" or other
    :: media pool name if required on your system]
    :: - use hardware compression (/HC:eek:n) if available
    :: - name the backup job (/J), tape (/N), and backup set (/D)
    :: "%ComputerName%-%DateDay%"
    :: - verify the backup (/V:yes)
    :: - do not restrict access to the tape to members of Administrators
    :: group (/R:no)
    :: - create a summary log file (/L:s)
    :: - use unmanaged backup method (/UM): whatever tape is in the drive is
    :: erased and used for the backup
    If %Trace%==Yes Echo NTBackup >>"%SBSProgramDir%\Backup\Trace.log"
    NTBackup backup "@%SBSProgramDir%\Backup\Small Business Backup
    Script.BKS" /M normal /SNAP:eek:n /RS:no /P "miniQIC" /HC:eek:n /J "%
    ComputerName%-%DateDay%" /N "%ComputerName%-%DateDay%" /D "%
    ComputerName%-%DateDay%" /V:yes /R:no /L:s /UM
    Echo NTBackup Return Code: %ErrorLevel% >>"%SBSProgramDir%\Backup
    :: Use the Removable Storage Manager to eject the tape from the drive.
    :: This is an important line when using IDE-based tape drives. NTBackup
    :: assumes ALL tape units eject their tapes.
    If %Trace%==Yes Echo RSM Eject >>"%SBSProgramDir%\Backup\Trace.log"
    RSM Eject /LF"Seagate STT3401A" /AStart
    Sleep 30
    :: Make a copy of the backup log in the SBS2003 folder used to save
    :: Backup Wizard logs, renaming the file and converting it from Unicode
    :: to ANSI in the process.
    :: NTBackup creates log file names of the form "backup??.log" where ??
    :: is a number from 01 through 10.
    :: Dir backup*.log /B /O:D >LogFiles.txt - Sends a list of NTBackup log
    :: file names only (/B) sorted in ascending order by date/time (/O:D)
    :: to LogFiles.txt. The last line of LogFiles.txt is thus the name of
    :: the newest log file: the one just created by the preceding NTBackup
    :: command.
    :: For /F %%f In (LogFiles.txt) Do Set NewestLog=%%f - Sends the lines
    :: of LogFiles.txt (i.e., the log file names) to a Set command, one by
    :: one. The final Set command is the only one that matters: it sets an
    :: environment variable to the name of the newest log file.
    :: The Type command converts the log file from Unicode to ANSI for
    :: e-mail purposes.
    ChDir %UserProfile%\Local Settings\Application Data\Microsoft\Windows NT
    Dir backup*.log /B /O:D >LogFiles.txt
    For /F %%f In (LogFiles.txt) Do Set NewestLog=%%f
    If %Trace%==Yes Echo Rename Log and Convert to ANSI >>"%SBSProgramDir%
    Type %NewestLog% >"%SBSProgramDir%\Support\Backup Logs\SBSBackup%
    Del LogFiles.txt
    :: Create an e-mail message to the person(s) who monitor the backups.
    :: The file Backup_EMail_Header.txt must be a pure ANSI text file of
    :: RFC822-compliant addressing information:
    :: To:[recipient's e-mail address(es), separated by commas]
    :: From:[SBS administrator's e-mail address]
    :: Subject:[Subject of your choice]
    :: NTBackup Log Follows:
    :: NOTE: The blank line after Subject: is required for correct
    :: operation.
    :: File SBSBackup%DateDay%.log is appended to this file to create a
    :: complete e-mail message file. The message file is copied to the
    :: Exchange mail Pickup folder where it will be automatically sent by by
    :: the SMTP Connector.
    If %Trace%==Yes Echo Create e-mail file >>"%SBSProgramDir%\Backup
    ChDir %SBSProgramDir%\Support\Backup Logs
    Copy Backup_EMail_Header.txt + SBSBackup%DateDay%.log
    If %Trace%==Yes Echo Copy file to Pickup >>"%SBSProgramDir%\Backup
    Copy Backup_EMail_Message.txt "C:\Program Files\Exchsrvr\Mailroot\vsi 1
    Del Backup_EMail_Message.txt
    :: Clean up the %SBSProgramDir%\Support\Backup Logs folder so it
    :: contains only the most recent 20 (4 weeks x 5 days/week) log files.
    :: Dir SBSBackup*.log /B /O:-N >LogFiles.txt - Sends a list of SBSBackup
    :: file names only (/B) sorted in descending order (/O:-N) to
    :: LogFiles.txt
    :: For /F "Skip=20" %%f In (LogFiles.txt) Do Del %%f - Skips the first
    :: 20 lines of LogFiles.txt (i.e., skips the 20 newest SBSBackup
    :: files), then deletes any older files.
    If %Trace%==Yes Echo Clean Up Backup Logs folder >>"%SBSProgramDir%
    Dir SBSBackup*.log /B /O:-N >LogFiles.txt
    For /F "Skip=20" %%f In (LogFiles.txt) Do Del %%f
    Del LogFiles.txt
    :: End of Small Business Server 2003 Backup script.
    Owen Williams, Sep 25, 2004
    1. Advertisements

  2. Owen Williams

    Henry Craven Guest

    Thanks Owen. Much appreciated.
    Look forward to giving it a Try and having a "play" with it.

    Henry Craven {SBS-MVP}
    Melbourne Australia

    Henry Craven, Sep 25, 2004
    1. Advertisements

  3. Owen Williams

    Axel Larson Guest

    That's a great job of scripting! I don't need it for tape backups but saved
    a copy anyway as an example of what can be done with ordinary batch
    Axel Larson, Sep 25, 2004
  4. Thanks for the kind words, Axel.

    -- Owen
    Owen Williams, Sep 26, 2004
  5. Owen Williams

    Beth Lowgren Guest

    And I was wondering why I had troubles getting my client's "new" Seagate
    STT220000 (with Travan 20gb tapes) to work!! It's been nearly impossible on
    both a win2k machine and sbs2003. Does partial backup then quits and "can't
    find the tape". I'm recommending client gets new tape drive. Their Travan was
    installed by previous consultant (had to make that VERY clear!). If they
    won't upgrade ("but I just BOUGHT the drive"), I may attempt to modify script
    for Travan. Any advice there?? :)

    Also, question about using the backup software included with SBS - would it
    make any difference using a different backup program (a la Retrospect) along
    with this drive? or is the limitation (uh, total failure) just with using the
    microsoft backup utility?


    Beth Lowgren, Jan 20, 2005
  6. Owen Williams

    Frank Guest

    I have had good success with the 20/40GB version of this drive. I do not
    use the built it SBS backup, I use a script that is scheduled to run
    nightly. I have found NTBackup to work quite well and wouldn't in most
    circumstances purchase backup software. I can post the script if you are

    As far as the error you a getting, have you been able to determine what
    is causing it. Are you using all the space on the tape? Are there errors
    communicating with the device? You should be able to find more
    information in the event log.

    - Frank
    Frank, Jan 20, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.