Using Ntbackup with Win2K and NT

What you need to know to pick the best storage solution for your environment.

Todd O. Klindt

June 19, 2000

11 Min Read
ITPro Today logo

You can migrate to Win2K to eliminate some of NTbackup's shortcomings, or you can work around them in NT

Windows NT's built-in backup program, ntbackup.exe, is good for quick, rudimentary file backups. In an enterprise environment, however, Ntbackup just doesn't have the necessary muscle. Enterprises need to run unattended backups during off-hours, but Ntbackup lacks a built-in scheduling facility. Enterprises also need to be able to back up remote resources and to maintain catalogs of backup media, but Ntbackup doesn't directly support these functions, either.

If you make the move to Windows 2000, you'll find that Microsoft has improved the new version of Ntbackup to address these three weaknesses. But not everyone is in a hurry to move to Win2K. For those of you who are sticking with NT for a while, I explain how to work around these Ntbackup weaknesses to schedule backups, back up resources on remote machines, and maintain catalogs of your media. And for those who are moving to Win2K, I explain how the new version of Ntbackup improves on NT's version in these areas.

Scheduling Backups
One of Ntbackup's shortcomings under NT is that the utility doesn't give you a way to schedule backups. Ntbackup's interface provides only for realtime archiving. In NT, you can work around this problem by using a scheduling service. Win2K's version of Ntbackup includes support for scheduled backups.

NT. If you don't have Microsoft Internet Explorer (IE) 5.0 installed, your NT system has a service called Scheduler. Scheduler executes commands that you might have scheduled by using the at.exe command-line utility or the Microsoft Windows NT Server Resource Kit's WinAt utility. Scheduler defaults to manual invocation, so if you plan to use Scheduler to execute backups, you might need to set it to automatic. After you start the Scheduler service, you can use at.exe to schedule events.

In IE 5.0, Microsoft replaced the Scheduler service with the beefed-up Task Scheduler. In addition to providing a friendly GUI, Task Scheduler lets you specify a user for each task so that you can carry out different tasks under different contexts.

After you start whichever NT scheduling service you choose to use, you can schedule backup scripts for execution. NT's Ntbackup version uses command-line parameters and switches to facilitate scripting. Executing the command ntbackup /? from the command line displays the part of the Help file that documents the switches that Ntbackup supports. A basic backup command might look something like

ntbackup backup D: /D "Important Files" /B /L "c:winntbackup.log"

This command tells Ntbackup to back up all files on the D drive, replacing anything that is currently on the tape. The /D switch tells Ntbackup to label the session Important Files. The /B switch backs up the Registry. The /L switch tells Ntbackup to log everything to the text file C:winntbackup.log.

After you write your backup command, you need to put it in a batch file for execution. Any batch file with a .bat or .cmd extension, such as fullbackup.bat or dailybackup.cmd, will do. Then, you can schedule batch file executions. The command

at 2:00 /every:F backup.bat

executes batch file backup.bat every Friday at 2:00 a.m.

You need to be aware of a couple of caveats about using Ntbackup. First, you can use a script to back up only a drive or directory; you can't use a script to back up one file. If you execute a script to back up a particular file, you'll receive the error message You do not have permission to access portions of filename. Microsoft TechNet explains that Ntbackup behaves this way by design. Neither the Win2K nor NT version of Ntbackup can back up individual files from the command prompt.

You also need to be sure you've loaded the correct tape. If a scheduled backup runs and you haven't swapped tapes, the scheduled backup will erase any data on the tape by default. One way to prevent a scheduled backup from accidentally overwriting the tape is to add a second command to your batch file. The command

ntbackup eject

ejects the mounted media. If you have more than one tape drive, you can use the /tape:number parameter to specify which tape the backup uses. Another option is to use Ntbackup's /A switch, which appends the new backup to any existing data on the tape instead of overwriting existing data.

If you experience problems with your scheduled NT backup job not running or not closing when it's finished, try running the job with the scheduling utility's /interactive switch. Microsoft didn't design the NT version of Ntbackup to run in the background, so running it in an interactive window can fix these problems. The sidebar "Undocumented Ntbackup Registry Keys," describes undocumented Registry keys that pertain to Ntbackup and that can give you control over scheduled backups.

Win2K. Win2K's Ntbackup version is much better than NT 4.0's version and includes built-in support for scheduled backups. To schedule a backup, click Start, Programs, Accessories, System Tools, Backup. The program's Welcome screen includes four tabs: Welcome, Backup, Restore, and Schedule Jobs. Select the Schedule Jobs tab to schedule a backup.

As Figure 1 shows, the Schedule Jobs tab displays a calendar month view. To schedule a recurring backup, you first select a date for Ntbackup to begin. Then, click Add Job to fire up the Backup Wizard. (For details about using Ntbackup's wizards, see the sidebar "Putting the Win2K Backup Wizards to Work," page 86.)

After you've chosen the data you want to back up, you'll see a screen that lets you specify whether you want to perform the backup immediately or schedule it for later. When you choose to schedule the backup, the wizard prompts you for the username and password under which to execute the job. Be sure you enter them correctly; Win2K doesn't verify the username and password until the job runs, and the backup will fail if you mistype the password or forget to select the correct account. After you've entered the account information, another screen lets you enter the time when you want the job to run.

To set the backup schedule, click Set Schedule in the When to Back Up window. You'll notice that the resulting window looks remarkably like the window you use to configure jobs with Task Scheduler. Ntbackup saves your job in a .bks file, which Task Scheduler uses to launch the job. As with all scheduled tasks, you can choose the time and frequency for the task's execution. After you've entered all the pertinent information, a summary window displays. Click Finish to finalize the schedule. To see exactly how the backup job is scheduled, you can use the Control Panel Scheduled Tasks applet to look at your task's properties. You can also tweak your backups from the Scheduled Tasks applet if you have to change the schedule for maintenance or other unplanned problems.

Backing Up Remote Resources
Another shortcoming of NT's Ntbackup version is that it can't back up remote resources. Ntbackup works great for backing up local drives, but if you need to back up a remote machine's hard disk, you're out of luck.

NT. In NT's Ntbackup version, you can work around this problem by mapping a local drive to the remote resource before you start Ntbackup. When Ntbackup comes up, it will enumerate all the drive letters that the system recognizes, including your network drive. If you start Ntbackup before you map the drive, you can map the drive you need without closing Ntbackup. Press Alt-Tab to toggle to Windows Explorer, map the drive, then toggle back to Ntbackup. Highlight the Drives window and press F5. Your system will recognize changes you made to your drives, and your remote drives will behave exactly like local drives.

NT uses the remote drive's Uniform Naming Convention (UNC) name as the label for the local drive. Because Ntbackup records the drive letter and the label when creating catalogs, you don't need to worry about which drive had the name J last August. You still might want to give the backup session a meaningful name so that you can match the backup files with the user whose workstation the files are from.

Win2K. Win2K's Ntbackup lets you back up remote drives. Open Ntbackup, choose the Backup tab, and expand Desktop. You have three main areas you can back up: My Computer, My Documents, and My Network Places. If you expand My Network Places, you can back up any machine that you can browse to on the network. Ntbackup will also enumerate hidden shares for you, as Figure 2 shows. You simply select the drives you want to back up.

Cataloging
NT's implementation of Ntbackup requires you to catalog a tape every time you want to browse its contents. This requirement is frustrating if you need to do a lot of restores.

NT. You might be surprised to learn that NT's Ntbackup version does make catalogs of your tapes, but Ntbackup deletes the catalogs every time it closes. Open Ntbackup and catalog a tape. Now, look in your Temp directory for the catalog file—its name ends with U01. If you copy that file to another directory and close Ntbackup, you'll see that the original file disappears. If you move the copy back into the Temp directory and open Ntbackup again, you'll see that the catalog of your tape is intact.

You can use this method to preserve NT catalog files. Before you exit Ntbackup, copy all catalog files to another location. Then, when you need to restore from a tape, copy the catalog files back into your Temp directory. This solution is by no means perfect, but it works.

Win2K. In Win2K, you don't need to copy catalog files to keep them intact. Win2K's Removable Storage Management (RSM) subsystem manages removable media. RSM's main function is to facilitate communication between applications and media devices such as CD-ROM jukeboxes and robotic tape libraries. One feature of RSM is media pools, which are collections of tapes or disks that you manage identically.

Two types of media pools exist: system media pools and application media pools. Only RSM uses system media pools. Applications use application media pools to control access to media groups that RSM manages. Programs can create application media pools, or you can create them manually by using the Microsoft Management Console (MMC) Removable Storage Management snap-in. Ntbackup creates and uses an application media pool named Backup.

RSM sends backed-up data to the Backup application media pool and creates a catalog of the data. When Ntbackup closes, RSM maintains the catalog. When you tell Ntbackup to restore data, RSM checks its database and makes available all the files it knows about. If you insert a DLT that contains data you backed up on an NT machine, RSM recognizes the data on the tape as NT's and lets you choose whether to put it in the Backup media pool, as Figure 3 shows.

To view the removable storage devices that your machine knows about, open the Computer Management console in the Control Panel Administrative Tools applet. The second main entry in the tree (i.e., Storage) contains the Removable Storage settings, as Figure 4 shows. If you expand Removable Storage, then expand Media Pools, three keys will appear: Free, Import, and Unrecognized. If you've created a Backup media pool, a Backup key will appear. If you don't already have a Backup media pool, RSM will create one the first time you import a tape from an earlier NT version. Under each Media Pools key are other keys for the types of removable media that your machine has devices to write to. I have a CD-Rewritable (CD-RW) drive and a DLT drive, so Figure 4 shows keys for CD-Recordable (CD-R), CD-RW, and DLT media. The Backup pool in Figure 4's right-hand pane shows the DLT tapes I've set aside for backup use. You can add other removable media to the Backup pool at any time. Find the media under one of the Media Pools keys, then drag it to the appropriate media type under Backup. A dialog box will ask you to confirm the move. After you confirm, the media will be available to you in Ntbackup.

To see how the Win2K's Ntbackup version saves catalogs, open Ntbackup. If you haven't used Ntbackup to back up data, do so now or import a couple of tapes from NT 4.0 to populate the catalog. Close Ntbackup, then open it again and click the Restore tab. In the Restore tree, identify an option that corresponds to the media type you're using. Expand the option to see all the media in the Backup media pool. Expand the tree for one of the media. You'll see an entry for each individual tape, CD-RW, or whichever media you're viewing. If you want to expand the catalog further, you'll need to load the appropriate tape media to see what is on it.

Putting Ntbackup to Use
Win2K's Ntbackup version eliminates some of the most annoying problems that exist in NT's version and provides a backup utility that is more useful in an enterprise environment. (To learn about some problems Win2K's Ntbackup has with Microsoft Exchange Server 5.5, see the sidebar "Ntbackup Exchange Server 5.5 Bug Fix.") If you don't have Win2K and won't be moving to it soon, you can use the tips I've described here to enhance NT's Ntbackup version.

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