JSI Tip 7914. How can I prepare for a scheduled backup to a stand-alone tape device that will require a 2nd tape?

JSI Tip 7914. How can I prepare for a scheduled backup to a stand-alone tape device that will require a 2nd tape?

Jerold Schulman

April 5, 2004

4 Min Read
ITPro Today logo in a gray background | ITPro Today

NOTE: See a revised tip at 7925 How can I prepare for a scheduled backup to a stand-alone tape device that will require a 2nd tape?

When you schedule a backup to a stand-alone tape device, even if you use the /UM switch, when the first tape fills up and is ejected, the backup will quit if you insert a tape that is NOT in the Free Media pool.

This problem is due to the fact that Removable Storage cannot write a free media label on a tape when the backup is run from a batch file.

To workaround this behavior, you must Prepare the extra tapes prior to starting the backup.

Windows Server 2003

I have scripted FreeMedia.bat to deallocate the mounted tape, write a free media label to it, and eject the tape.

The syntax for using FreeMedia.bat is:

FreeMedia TapeString

Where TapeString is any unique portion of the LIBRARY name.

Example:

When I open a CMD.EXE window and type rsm view /tlibrary, it returns:

LIBRARY

Off-line Media
SAMSUNG DVD-ROM SD-616T
_NEC DVD+RW ND-1100A
Seagate STT3401A USB Device
HP Ultrium 2-SCSI SCSI Sequential Device

The command completed successfully.

Since the Library I want to use is the HP Ultrium 2-SCSI SCSI Sequential Device, running: FreeMedia ultrium would select the proper library.

FreeMedia.bat contains:

@echo offIF {%1}

{} @echo Syntax: FreeMedia TapeString&Exit /b 1 setlocal set string=%1 set string=%string:"=% call :silent>nul 2>&1 if not defined media @echo No media in library endlocal exit /b 0 :silent for /f "Tokens=2-15" %%a in ('rsm view /tlibrary /guiddisplay^|Findstr /i /c:"%string%"') do ( if not defined tape if not {%%n}

{} set tape=%%n if not defined tape if not {%%m}

{} set tape=%%m if not defined tape if not {%%l}

{} set tape=%%l if not defined tape if not {%%k}

{} set tape=%%k if not defined tape if not {%%j}

{} set tape=%%j if not defined tape if not {%%i}

{} set tape=%%i if not defined tape if not {%%h}

{} set tape=%%h if not defined tape if not {%%g}

{} set tape=%%g if not defined tape if not {%%f}

{} set tape=%%f if not defined tape if not {%%e}

{} set tape=%%e if not defined tape if not {%%d}

{} set tape=%%d if not defined tape if not {%%c}

{} set tape=%%c if not defined tape if not {%%b}

{} set tape=%%b if not defined tape if not {%%a}

{} set tape=%%a ) rsm INVENTORY /LG%tape% /AFULL @ping -n 31 127.0.0.1>null for /f "Skip=1 Tokens=2-19" %%a in ('rsm view /tphysical_media /cg%tape% /guiddisplay^|Findstr /v /c:"The command"') do ( if not defined media if not {%%r}

{} set media=%%r if not defined media if not {%%q}

{} set media=%%q if not defined media if not {%%p}

{} set media=%%p if not defined media if not {%%o}

{} set media=%%o if not defined media if not {%%n}

{} set media=%%n if not defined media if not {%%m}

{} set media=%%m if not defined media if not {%%l}

{} set media=%%l if not defined media if not {%%k}

{} set media=%%k if not defined media if not {%%j}

{} set media=%%j if not defined media if not {%%i}

{} set media=%%i if not defined media if not {%%h}

{} set media=%%h if not defined media if not {%%g}

{} set media=%%g if not defined media if not {%%f}

{} set media=%%f if not defined media if not {%%e}

{} set media=%%e if not defined media if not {%%d}

{} set media=%%d if not defined media if not {%%c}

{} set media=%%c if not defined media if not {%%b}

{} set media=%%b if not defined media if not {%%a}

{} set media=%%a ) @ping -n 6 127.0.0.1>null for /f "Skip=1 Tokens=2-15" %%a in ('rsm view /tpartition /cg%media% /guiddisplay^|Findstr /v /c:"The command"') do ( if not defined part if not {%%n}

{} set part=%%n if not defined part if not {%%m}

{} set part=%%m if not defined part if not {%%l}

{} set part=%%l if not defined part if not {%%k}

{} set part=%%k if not defined part if not {%%j}

{} set part=%%j if not defined part if not {%%i}

{} set part=%%i if not defined part if not {%%h}

{} set part=%%h if not defined part if not {%%g}

{} set part=%%g if not defined part if not {%%f}

{} set part=%%f if not defined part if not {%%e}

{} set part=%%e if not defined part if not {%%d}

{} set part=%%d if not defined part if not {%%c}

{} set part=%%c if not defined part if not {%%b}

{} set part=%%b if not defined part if not {%%a}=={} set part=%%a ) rsm deallocate /pg%part% @ping -n 6 127.0.0.1>null rsm freemedia /pg%media% @ping -n 6 127.0.0.1>null rsm eject /pg%media% /ASTART

Windows 2000 and Windows XP

Since these operating systems do NOT currently support the rsm freemedia command, manually de-allocate and free the media:

01. Right-click My Computer and press Manage.

02. Use Computer Management / Storage / Removable Storage / Physical Locations / .

03. Right-click the and press All Tasks / Inventory.

04. After the inventory completes, expand Media under .

05. Right-click the mounted tape and use All Tasks / Deallocate.

06. If prompted to confirm, press YES.

07. Right-Click the media you deallocated and then press Prepare.

08. Press YES if prompted to confirm.

09. Use the Eject Wizard to eject the tape.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like