Microsoft KB Archive/314844

= How to schedule unattended backups by using a stand-alone tape library =

Article ID: 314844

Article Last Modified on 2/19/2007

-

APPLIES TO


 * Microsoft Windows XP Professional
 * Microsoft Windows Server 2003, Standard Edition (32-bit x86)

-



This article was previously published under Q314844



SUMMARY
This article describes how the Windows backup tool (Ntbackup.exe) is designed to work with Removable Storage Manager (RSM) to manage media during a backup session. This method is especially effective if you have a tape library that holds several tapes, because RSM can automatically mount and dismount tapes when the scheduled backup program calls for a tape. This makes unattended backups possible because RSM loads the correct tape and either overwrites or appends to the tape, depending on the backup options that you select.



MORE INFORMATION
If you have a stand-alone tape library (that is, one that requires you to manually load or unload media), you can schedule nightly unattended backups provided the data that you are backing up can fit on a single tape. If the data cannot fit on a single tape, the NTBackup tool pauses and asks for new (prepared) media, regardless of which of the following methods you use.

There are two methods that you can use to perform unattended backups.
 * Managed method

You can use this method when you want to manage your media. This method ensures that the proper tape is always in the tape drive before the backup overwrites the tape. This is the recommended method.
 * Unmanaged method

If you use this method, the current backup just overwrites the tape that is currently in the stand-alone tape drive. This method is easier to implement, but the backup may overwrite critical data if the correct tape is not in the tape drive before you start the scheduled backup. This method is not recommended if you are sharing the stand-alone tape drive with different programs.

Managed Method
To use this method, label the tapes (one for each day of the week), and then schedule a recurring weekly backup (one for each day). The only manual intervention that is required is to make sure that the previous night's backup tape is ejected and the next night's tape is inserted into the stand-alone tape library. A non-technical assistant can perform this manual operation any time before the next scheduled backup session.

The following section outlines the basic concept and the steps necessary to prepare and label the tapes and tells how to schedule Ntbackup to use the tapes. The example that is used is an abbreviated example that shows how to perform normal backups every night (Monday through Friday), overwriting the tape each time. Depending on your needs, you can perform incremental backups during the week and then perform full backups on the weekend by using different sets of tapes.

Before Ntbackup can use a tape, the tape must be located in the RSM import, free, or backup media pool.
 * Import media is media that RSM recognizes as being compatible with an installed program like Ntbackup but that has not yet been cataloged and moved to that program's media pool. If Ntbackup detects and recognizes media in the import media pool, a message asks whether you want to import the media. After the media is imported, you can use it for a restore operation or for a new backup.
 * Free media is media that RSM prepares for any program to use by writing a free media label. Programs pull tapes from the free media pool the first time you use a tape, and then allocate the tape to that program's media pool for use with future jobs.
 * The backup media pool is an application media pool that consists of media that Ntbackup allocates for its own use.

Preparing the Tapes
Use the following steps to prepare each tape that you want Ntbackup to use. This operation writes a &quot;free media&quot; label on each tape. Remember that Ntbackup can use only prepared tapes during a backup session. Calculate how many tapes you need for your backup strategy, and prepare each tape before you continue to the next section.
 * 1) Under Computer Management, expand Storage, expand Removable Storage, and then click Media.
 * 2) Insert a tape into the tape drive. RSM reads the tape, and then displays the tape in the right pane.
 * 3) In the right pane, right-click the tape, and then click Free to remove data from the tape and mark it as free. You can monitor the work queue for the operation to make sure the operation is finished, or you can wait for the state to change to Idle and Usage to change to &quot;Free.&quot;
 * 4) After the tape is labeled as &quot;free media,&quot; you can eject the tape by right-clicking the tape and then clicking Eject. The Eject Wizard starts and moves the tape to the off-line media library.

Labeling the Tapes
After you prepare the tapes, use Ntbackup to write a Microsoft Tape Format (MTF) label. Use a name that describes the contents of the tape. After this is accomplished, you can schedule Ntbackup to use that tape over and over again, by specifying the same media label name.

Use the following steps to label each tape that you want Ntbackup to be able to reuse.

NOTE: This operation writes a unique MTF label on each tape. Make sure that each tape has a unique name, even if you rotate different sets of tapes (weekly).
 * 1) Make sure that a prepared tape is in the stand-alone tape library.
 * 2) Start Ntbackup, and then click Backup Wizard.
 * 3) In the What to Backup dialog box, click backup selected files, drives, or network data.
 * 4) In the Items to Backup dialog box, click a single folder on any local drive.
 * 5) In the Where to Store the Backup dialog box, under backup media type, click the tape drive, and in the backup media area, click new media.
 * 6) In the Completing the Backup Wizard dialog box, click Advanced.
 * 7) Continue through the screens until the Backup Label dialog box is displayed. In this dialog box, you can change the Backup Label and Media Label fields.

The information in the Media Label field distinguishes one tape from another. Change the Media Label field so that the field contains meaningful information to represent a tape for each day of the week. The example in this article uses unique names like Monday-Full, Tuesday-Full, and so on (one for each day/tape).
 * 1) Continue through the dialog boxes, and then start the backup process. This backs up the single folder and writes a meaningful media label that you can use from now on to schedule backups.
 * 2) After the backup process finishes, quit Ntbackup.
 * 3) If you now view Removable Storage Media, you see that the tape shows &quot;Application&quot; under Usage. Right-click the tape to view its properties. If you click the side tab, you see that the identification label field contains the same name that you specified in step 7. That is the name you want to use from now on, whenever you schedule a backup for that day's tape and choose to rewrite the same label name.
 * 4) Right-click the tape, click Eject, and then physically label the tape, using the same label name that you specified during the backup.
 * 5) Repeat this procedure for each tape until all of the tapes have valid MTF media labels.

Scheduling Recurring Weekly Backups
You can schedule recurring weekly backup jobs by using the built-in scheduler in Ntbackup. You can choose to build a batch file to use with the Scheduled Tasks Wizard or the at schedule command.

First, use Ntbackup to create a backup selection (.bks) file that Ntbackup uses to detect which drives/folders/files to back up. You also need to use Ntbackup to build the backup command line string to be used in the batch files if scheduling outside of the backup scheduler.

To schedule recurring weekly backups:
 * 1) Start Ntbackup, and then click Backup Wizard. If Ntbackup starts in Wizard mode, click Next, click Back up files and settings, and then click Next.
 * 2) Click the option to Let me choose what to back up, and then click Next.
 * 3) Follow the wizard screens, and specify the volumes or folders that you want to back up every night.
 * 4) In the Where to Store the Backup dialog box, under backup media type, click the tape drive, and in the backup media area, click the name of the tape that matches the day for which you are currently scheduling the backup (for example, Monday-Full).
 * 5) In the Completing the Backup Wizard dialog box, click Advanced.
 * 6) In the Backup Options dialog box, click Replace the existing backups.
 * 7) In the Backup Label dialog box, change the Backup and Media Label fields to match the media label of the current tape. This ensures that the same tape can be mounted during the next recurring backup for this day's tape.
 * 8) In the When to Backup dialog box, click Later, and then type a descriptive job name.
 * 9) Click Set Schedule, and schedule the backup to run at the appropriate time. To make this day's backup recurring, click Weekly in the Schedule Task list.
 * 10) Repeat this procedure for each day of the week, scheduling the backup to occur weekly. Make sure that you use the correct media label to match that day's tape name.
 * 11) Make sure that the labeled tape for the current backup is in the stand-alone tape library.

If you want to schedule a batch file to perform additional tasks along with the backup, you can copy the backup command string from a scheduled backup job by viewing any of the scheduled tasks properties from the Schedule Jobs tab in Ntbackup or by using the Scheduled Tasks tool in Control Panel. You can then put the command string in a separate batch file, modify the string to fit your needs, and schedule the batch file to run by using the at command or Task Scheduler.

The following example shows a backup command line that was copied from the properties of a scheduled backup:

c:\winnt\system32\ntbackup.exe backup &quot;@c:\documents and settings\bkupuser\local settings\application data\microsoft\windows nt\ntbackup\data\daily.bks&quot; /n &quot;monday-full&quot; /d &quot;mondays full backup&quot; /v:no/r:no /rs:no /hc:on /m normal /j &quot;mondays job&quot; /l:f /t &quot;monday-full&quot;

The last parameter can be /g guid to represent the RSM Logical_Media ID instead of /t for &quot;tape_name.&quot; The {guid} value is a 32-byte value in the form of &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.&quot; You can use either parameter to represent and use the tape in a batch file. Besides looking at the properties of a scheduled backup job, the {guid} values for all logical media can be extracted by using the following Rsm.exe command. They are not listed in order, so it is difficult to tell which {guid} value represents which tape.

rsm.exe view /tphysical_media /guiddisplay

You can also use the Rsm.exe command-line tool in the batch file to instruct RSM to eject the tape when the backup is finished. Use Rsm.exe and issue the following command to extract the physical media names ahead of time to use with the eject command:

rsm view /tphysical_media

'''PHYSICAL_MEDIA

Monday-Full - 1

Tuesday-Full - 1

Wednesday-Full - 1

Thursday-Full - 1

Friday-Full - 1'''

The command completed successfully.

After the backup is finished, in each day's batch file, use the rsm eject command to eject that day's tape:

rsm eject /pf&quot;monday-full - 1&quot; /astart

The following example shows a sample backup batch file that is to run on Mondays:

echo off

start /wait c:\winnt\system32\ntbackup.exe backup &quot;@c:\documents and settings\bkupuser\local settings\application data\microsoft\windows nt\tbackup\data\daily.bks&quot; /n &quot;monday-full&quot; /d &quot;mondays full backup&quot; /v:no/r:no /rs:no /hc:on /m normal /j &quot;mondays job&quot; /l:f /t &quot;monday-full&quot;

rsm eject /pf&quot;monday-full - 1&quot; /astart

Unmanaged Method
To use the unmanaged method, just use the /um option at the end of the backup command string. This tells Ntbackup to find the first available tape, format the tape, and then use that tape for the current backup operation. When you use the /um option, you must use the /p option to designate a media pool device (for example, &quot;8mm mp&quot;). If you do this, you must not use the following options:

/a

/g

/f

/t

When you use the /um option, Ntbackup searches the following media pools for available media:
 * Free pool
 * Import pool
 * Unrecognized pool
 * Backup pool

When Ntbackup detects an available tape, the search stops, and the tape is formatted and used without prompting you for input. This command is not applicable to tape loaders; use this command only if you have a stand-alone tape device.

NOTE: The /um option works on only the initial tape request. The /um option was not intended to be used when spanning tapes, because spanning tapes requires human intervention. Ntbackup does not overwrite any tape other than the original (first) tape of a backup set; you must use RSM to manally prepare any additional tapes before Ntbackup will use a tape to complete the scheduled backup.

Related Issues
Note that some low-cost, stand-alone tape drives do not notify RSM that media has been changed. If you are using this type of tape drive, one of the following error messages is recorded in the backup report during the next backup cycle:

The operation was not performed because no unused media was available.

-or-

Operation was not performed, because the specified media cannot be found.

Additionally, if you are trying to schedule a recurring backup to a single tape device by using the /p option, you may see either of the errors listed above in the backup report. Or, if you are using a Windows Server 2003-based computer, you may receive the following error message:

Cannot locate the specified media or backup device. This backup operation will terminate.

To prevent these errors, refer to the following article in the Microsoft Knowledge Base for a solution or a workaround:

267574 Scheduled Backups Fail on Standalone Tape Drives After Changing Media

If you use the /um option, it is recommended that you not use the /n option to label the media. Instead, permit Ntbackup to use the default date/time as the label name and description. This eliminates the problem of multiple tapes' having the same label name, which can cause RSM to ask for a manual tape mount and prevent Ntbackup from continuing to completion unattended. If you want to re-use the same tape for a scheduled incremental backup by appending to the same tape, you should use the &quot;managed method&quot; described above instead of using the /um option.

Examples of Backup Batch Files
The following are examples of backup batch files. The second example requires the Sleep.exe utility from the Windows 2000 or Windows XP Resource Kit to ensure reliability.

Example 1   echo off start /wait rsm.exe refresh /lf&quot;your_library_name&quot; c:\winnt\system32\ntbackup.exe backup &quot;@c:\documents and settings\bkupuser\local settings\application data\microsoft\windows nt\ntbackup\data\daily.bks&quot; /v:no /r:no /rs:no /hc:on /m normal /j &quot;daily.job&quot; /l:f /p &quot;8mm mp&quot; /um Example 2

This is a more complex example, however, it is a real-life example that performs the following procedures completely unattended:  Refreshes the RSM database. Sleeps for 30 seconds to make sure that RSM is refreshed. Sets environment variables that are used to create unique tape names. Starts Ntbackup, which mounts any existing tape in the tape drive by using the /um option. Performs the backup and changes the tape name to the following format:

 Ejects the tape from the tape drive.</li></ul>

Here is the example. <pre class="fixed_text"> echo off rsm.exe refresh /LF&quot;HP C1537A SCSI Sequential Device&quot; sleep 30 for /f &quot;Tokens=1-4 Delims=/ &quot; %%i in ('date /t') do set  dt=%%i-%%j-%%k-%%l for /f &quot;Tokens=1&quot; %%i in ('time /t') do set tm=-%%i set tm=%tm::=-% set dtt=%dt%%tm% c:\winnt\system32\ntbackup.exe backup &quot;@C:\Documents and  Settings\Administrator\Local Settings \Application Data\Microsoft\Windows NT\NTBackup\data\Daily.bks&quot; /n &quot;%computername%-%dtt%&quot; /d &quot;daily %dtt%&quot; /v:yes /r:no /rs:no /hc:on /m normal /j &quot;daily %dtt%&quot; /l:f /p &quot;4mm DDS&quot; /UM rsm.exe eject /PF&quot;%computername%-%dtt% - 1&quot; /astart exit For a list of all available backup options or for detailed information about options that are used in these examples, refer to the Ntbackup Help file. Type the following command at a command line:

ntbackup /?

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

234492 Backup Creates New Tape GUID When Writing New Label

267574 Scheduled Backups Fail on Standalone Tape Drives After Changing Media

243260 Changed Command Parameters for Scheduled Backup Job May Not Be Saved

204833 Backup Can Select Only the First of Two Identical Tape Drives

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

269600 Hewlett-Packard SureStore Tape Drive May Not Work on Computers with Large Amounts of Memory

242881 Advanced Settings Are Not Honored with Scheduled Backups

264604 Scheduled Backup Jobs May Not Run As Expected

295159 Scheduled Backups May Hang After Mounting Tape.

Additional query words: unattend scheduled standalone backups

Keywords: kbfaq kbinfo KB314844

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.