Windows Administration

Preserve Your Data With The Backup Tool You Already Have

Jay Shaw

 

At a Glance:

  • An overview of how Ntbackup works
  • Implementing Ntbackup on Windows 2000 Server, Windows Server 2003, and Windows XP
  • How to decide if Ntbackup is an appropriate solution
  • Ntbackup best practices and troubleshooting tips

Windows 2000 Server

Windows XP

Windows Server 2003

Ntbackup

If the headline of this article has caught your eye, I bet you've seen a message like this in your backup logs: "The operation was not performed because no unused media was available."

Or how about this one: "Operation was not performed, because the specified media cannot be found." Or even: "The requested media failed to mount. The operation was aborted."

I have good and bad news for you. The bad news is that your log messages are just a symptom of a larger problem. The cause of the problem is, more often than not, a misconception about how Ntbackup works. I have a sign on the wall of my office that reads "Things should just work!" But in the real world it's just not that simple.

The good news is that if you are willing to spend a little time doing your homework and learning how Ntbackup works, you can have all the benefits of a solid backup program without purchasing any additional software. It's included with Windows® XP, Windows 2000 Server, and Windows Server™ 2003, and it can back up all versions of Exchange Server as well.

I have seen many people abandon Ntbackup in favor of third-party products before ever really exploring its potential. Many of these products are very robust and offer features that are not available with Ntbackup. They can sometimes be easier to implement and they look really cool, too. As with most things, however, there is a catch. They can be extremely expensive; even more so if you need to back up an Exchange Server. These otherwise costly extra items are included with Ntbackup (assuming the services are located on the same server as the tape backup). If you have a standalone server, why spend more than you have to?

When Windows 2000 Server was released, like most people I opened Ntbackup, found the scheduler, set up a job, and clicked Run. After all, why would I need to read up on backup software, right? I was just so happy I didn't have to load the scheduler service from the Resource Kit the way I had to with Windows NT® 4.0. Big mistake on my part! It did work, but only sort of. I got one backup on each tape and then it began to fail. You see, I hadn't done my homework. Ntbackup is a little intricate and things just aren't quite that easy.

How the Pieces Work Together

Ntbackup on Windows XP, Windows 2000 Server, and Windows Server 2003 works in several pieces. There are three separate programs that are used to schedule a backup. These include: ntbackup.exe, the Scheduler Service, and the Removable Storage service. When you have an understanding of how these parts work together (and sometimes don't) you are in a much better position to find the source of a problem and achieve Ntbackup nirvana.

The first piece is ntbackup.exe itself. As the actual backup program, its job is to determine exactly what it is you would like to back up. It also tells the Removable Storage Manager (RSM) what media you would like to use, whether or not to verify the backup job, whether or not to use hardware compression, and a whole host of other options.

Ntbackup.exe functions with both a command-line utility as well as offering a GUI front end. This really comes in handy when your needs outgrow the basic package. It allows you to easily use batch files to automate more complex tasks with Ntbackup that would otherwise be all but impossible. I have seen several of these scripts advertised on the Internet. Some of them are quite good (and free, or at least inexpensive) and can give you many additional features and greater reliability for your backups. Examples of their features are e-mail notifications, easier management of the RSM, reminders for tape changing, even ejecting the tape at the end of a job. Ntbackup allows you to specify the files to be backed up, where to back them up, and how. These command-line options can be found at the command prompt by typing ntbackup /?.

The next important piece is the Scheduler Service. The scheduling appears to be integrated into ntbackup.exe. At least that's what I thought the first time I saw the GUI. The calendar is right there with options for how often and when backups are to occur. Upon further investigation, however, you will find that this task is actually handled by the Scheduler Service. When you use the Ntbackup GUI to create a backup job, the commands are translated into command-line options and placed in the Scheduler Service.

Figure 1 Scheduling a Job

Figure 1** Scheduling a Job **

An example of this is shown in Figure 1. Here you can see that the backup job is scheduled for 11:59 P.M. on weekdays. Once that has been saved, if you go to the control panel and check the Scheduler Service, you will find that the following command has been entered:

C:\WINNT\system32\ntbackup.exe backup 
"@C:\Documents and Settings\Administrator\Local 
Settings\Application Data\Microsoft\Windows 
NT\NTBackup\data\Full.bks" /n "Media created 8/
20/2003 at 3:30 PM" /d "Set created 8/20/2003 
at 3:31 PM" /v:yes /r:no /rs:no /hc:on /m 
normal /j "Full.job" /l:s /p "8mm AIT1" /um

Basically, this tells you to back up all the files specified to your tape drive at the specified time and not to use RSM to manage media. Now if you modify this command, you can change the job in any number of ways without touching the GUI. Note that if you make any changes you will be prompted for the service account password.

If you need to run additional tasks along with your backup job, you can access the scheduled backup command from the Scheduled Tasks icon in Control Panel. Simply right-click the backup job and select Properties. The task will appear on the Run line, just like in Figure 2.

Figure 2 Running Additional Tasks

Figure 2** Running Additional Tasks **

All you need to do now is copy this line to a batch file and add whatever you like. Once you're finished, you can go back into the Command Scheduler and schedule the batch file to run instead of the command that was there.

While you're at it, you might want to add a line to refresh the contents of the tape drive. This can be very helpful since some tape drives do not always refresh their contents when a tape is changed. When the RSM loses track of the drive contents, you will get an error in the log that says "The operation was not performed because the specified media cannot be found." I do this with every job since it certainly doesn't hurt.

First go to the command prompt and type the following command:

rsm view /tlibrary 

This will give you the name of your tape library. Add the following to your batch file before the backup command is run:

rsm.exe refresh /lf"library name"

This will ensure that RSM knows what tape is in the drive before any backup job is run.

The third piece to this puzzle is the RSM itself, whose job is to manage your backup media and your backup devices. Windows can use any number of devices for backup. Tape drives are the most common, but many people use JAZ drives, CD-RW disks (though this requires extra configuration), hard disks, even floppies and zip drives. Of all these options, I strongly recommend the use of a tape drive. I know of many small offices using a second hard drive or any number of other unique solutions in order to avoid the cost of a decent tape drive. A tape drive allows you to have many copies of your data and store some of those copies offsite in case of a fire or other disaster. It is a device that is built specifically for this purpose and in my opinion it's the best choice.

The RSM controls which device and, more importantly, which set of media is to be used. It also monitors the status of these devices. In the case of tape drives, it even tracks whether the device has been cleaned.

Managed versus Unmanaged Media

So now that you understand how Ntbackup works, you can just go in, schedule a job, throw a tape into the drive, and you're good to go, right? Well, not exactly. This is where most people (myself included) have run into trouble.

First you need to decide if you are going to use managed or unmanaged media. You have to decide if you want Ntbackup to wait for you to insert a specific tape, for example the "Monday" tape, or if you want to overwrite whatever tape happens to be in the drive at the time.

If you don't really care which tape is which, you can go with unmanaged media. If you add the /um switch to your backup command in the command scheduler, Ntbackup will use whatever tape is in the drive for your backup. This is what I like to call a quick-and-dirty solution. If you forget to change the tape one night you will still get a backup, but you'll lose the backup from the night before. If you back up your entire server on one tape you can get away with this, but it's not optimal. I wouldn't use this method if you have any intention of doing incremental backups. As an alternative, you could add a command to eject the tape at the end of your backup job, but if you're going to do that, perhaps you should instead consider using managed media.

Microsoft strongly recommends that you use managed media. Unmanaged media is still supported in Windows Server 2003, but Microsoft removed the documentation for it from the help file so they must feel pretty strongly about it. Using managed media is a little more complex, but it's also safer. Ntbackup will look for a specific tape that came from a specific pool (a group of tapes) which is in a specific library (a backup device). The best way to do this is to use the RSM to label each of the tapes in your rotation according to the day of the week. You should then schedule a separate backup job for each day of the week that requests the appropriate tape.

The advantage here is that if the tape is left in the drive a second night, it will not be overwritten. The backup job will request the appropriate tape and wait. With this method, you can effectively do incremental backups during the week when time is at a premium, and then you can schedule a full backup over weekends.

Did You Prepare Your Tapes?

Backup tapes need to be prepared and marked as free in order for Ntbackup to make use of them. You only need to do this once, but it needs to be done before the media will be recognized by the system. It's a quick and simple process. Go to Computer Management, click storage, click removable storage, and then click Media. You'll see the screen shown in Figure 3.

Figure 3 Preparing Backup Tapes

Figure 3** Preparing Backup Tapes **

Once you insert a tape, you should see it listed on the right side of the screen. All you need to do is right-click the tape and select Free. This clears the tape and allows Ntbackup to use it. This is an important step that is often overlooked. Without completing this process, you're not going to be backing up anything at all.

It can be quite frustrating to work with a package without having a complete understanding of all that's going on in the background. Perhaps now you can see that Ntbackup can be a reliable, feature rich, and inexpensive alternative to third-party solutions. When you understand what is going on in the background, it becomes a lot easier to troubleshoot common problems that would otherwise be quite frustrating.

Remember Ntbackup is a tool just like any other piece of software, so it's important that you keep its intended purpose in mind. If you just need to back up a single server and the backup device is local, Ntbackup will most likely fit the bill. You can have a working backup tool that will suit the needs of most small networks and you don't need to purchase any additional software. It is not an enterprise tool, however. If you are in an environment with many servers, I would recommend that you investigate a third-party solution that will give you an integrated package.

Ntbackup Best Practices

Here is a list of 10 things to check when you are not getting what you want from Ntbackup:

1. Using the correct media Remember Ntbackup works with the RSM to manage your media. By default, Ntbackup will look for a specific tape.

2. The /um command-line switch If you have trouble with a backup running, try adding the /um switch to your backup command. It will tell Ntbackup to use whatever media is available in the tape drive.

3. The RSM refresh command On some tape drives, the RSM fails to notice that you have changed the tape in the drive. Try using this command to force a refresh.

4. Media allocation Don't forget to allocate your media. If you don't, Ntbackup will not recognize your tapes.

5. Hotfixes and services packs There have been several updates to ntbackup.exe. Make sure you have all your patches loaded!

6. The Hardware Compatibility List (HCL). Ensure that your tape drive is on the HCL since hardware changes all the time. There are many backup devices on the market that come with their own software. This is often the case when the device is not meant to work with Ntbackup.

7. Logs Always check your backup and event logs (the latter especially when Ntbackup exits without giving any meaningful error messages). If you don't, you either won't know you have a problem or you won't know what's causing the problem. Make sure you look carefully and double check that everything you need backed up is listed in the log.

8. Remote desktop sessions Whether in a connected or disconnected state, remote desktop sessions can cause Ntbackup to hang. Make sure you don't have any open. See support.microsoft.com/kb/555136 for more information.

9. The command prompt If your scheduled backup won't run, try running the command from the command prompt. This will let you know if syntax is the culprit or if some other problem is to blame.

10. Task manager When Ntbackup hangs, there are often multiple instances of ntbackup.exe listed in the task manager. Don't just cancel them. Make sure you reboot the server or the backup may still not run correctly.

Jay Shaw is an independent network consultant. His company, Network Consulting Services, is located on Long Island in New York. He can be reached at info@ncservices.net.

© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.