Problem solve Get help with specific problems with your technologies, process and projects.

Automating backups, Part 1: Crash course on RSM

The NTBACKUP program in Windows Server 2003 lacks some of the features found in many third-party backup solutions -- its abilities to manage a library of tapes or use a tape drive with an auto loader are, at best, limited. But you can create a script that leverages the power of the Windows Removable Storage Manager (RSM) interface in a way that gives you much more control over NTBACKUP.

The NTBACKUP utility may lack some of the features found in many third-party backup solutions -- for instance, its abilities to manage a library of tapes or to use a tape drive with an auto loader are, at best, limited. You can, however, create a script that leverages the power of the Windows Removable Storage Manager (RSM) interface in a way that gives you much more control over NTBACKUP.

But before you can create this script (part two of this article will show you how), you'll need a crash course in Windows Removable Storage Manager. Even though we won't be using RSM's GUI in our script, you'll need to understand what the RSM is all about before you can make use of it. To access the RSM, select the Computer Management command from Windows Administrative Tools menu. When the computer management console opens, you can find the Removable Storage console beneath the Storage container.

Basically, the RSM acts as a simple database that keeps track of backup-related resources. RSM is divided into five sections: Media, Media Pools, Libraries, Work Queue and Operator Requests (see Figure 1). This article, however, will look at only the first three: Media, Media Pools and Libraries. (The Work Queue and Operator Requests containers, which simply store instructions that are sent to the storage device, are irrelevant to what we will be doing.)

Libraries container: RSM uses the word library to describe a physical, removable storage device, such as a tape drive or a CD-RW drive. In the RSM relational database, the Libraries container stores listings for removable storage devices.

Media container: In the RSM, the word media describes anything that can be put into a removable storage device -- for example, tapes, CDs and DVDs. But if you open the media container, you'll see that it doesn't just contain generic representations of CDs and tapes; it also lists the specific media in the drive at that very moment. For instance, if you inserted the Windows Server 2003 installation CD into a CD drive, you would see that CD listed in the Media container.

Media Pools container: This section has three containers by default -- Free, Import and Unrecognized -- but other containers can be added by various applications.

RSM is a database designed to keep track of backup-related resources. As you might expect, RSM keeps track of your backup tapes. When you insert a backup tape into the server's tape drive, the tape is assigned one of three categories (by default): Free, Import or Unrecognized. A listing for the tape is then displayed in the appropriate Media Pool. To be more precise, the Media Pool will list the device containing the tape and will display the tape just below that device. For example, my test machine does not have a tape drive, but I have inserted a CD into the machine, and RSM has placed the CD into the Import category. As Figure 2 shows, the CD is actually listed under Media Pools | Import | CD-ROM. The Media Pool lists the media on a per-device basis.

What do the various Media Pool categories mean? The Unrecognized Media container displays tapes that RSM considers to be unformatted. (Although most tapes you buy nowadays come preformatted, RSM will treat the tape as unformatted because RSM has not written any identifying information to the tape. When a tape is in the Unrecognized Media container, RSM can't do anything with the tape until the tape is prepared for use.)

Once RSM has prepared a tape for use, the tape is moved from the Unrecognized container to the Free container. The Free container is for blank tapes that have been prepared for use by RSM. Tapes in the Free container are ready to be used.

Let's say you insert a tape that contains data. Which container does RSM list the tape in? Actually, this is a trick question. Four paragraphs back I told you there were three containers by default, but other containers could be added by various applications. When you use an RSM-aware backup application for the first time, the application creates its own Media Pools container. For example, NTBACKUP creates its own Media Pool, as does Windows Remote Storage service. Third-party applications also create Media Pools, as long as the application is RSM-compliant.

Let's return to the question of where a tape containing data gets listed in the Media Pools. When you insert the tape, RSM analyzes its contents to see which application created the tape. If RSM recognizes the application, the tape is listed under that application's Media Pool. For example, if you created a tape in NTBACKUP and then inserted that tape later on, RSM would see that the data on the tape was created by NTBACKUP and would associate the tape with the NTBACKUP Media Pool.

On the other hand, if RSM doesn't recognize the application that created the data on the tape, it will check to see if the tape has an RSM identification on it. Remember, RSM prepares a new tape for use, even if the tape is already formatted. If RSM finds an RSM identification on the tape, but does not recognize the application that wrote the data to the tape, it places the tape in the Import category -- a catch-all category.

In other words, the tape can't go into the Unrecognized or Free categories because it isn't blank. And RSM doesn't recognize the application that created the data on the tape, so the Import category is used as a sort of purgatory until an administrator installs an application that will recognizes the tape or performs an action that moves the tape into a different category.

In part two of this article, I will show you how to create a batch file that can use the RSM in conjunction with NTBackup. In part three, I will talk more about this and show you how to bridge the gap between the RSM and NTBACKUP. In part four, I will show you the commands you can use to invoke NTBACKUP.

About the author:
Brien M. Posey, MCSE, is a Microsoft Most Valuable Professional for his work with Windows 2000 Server and IIS. He has served as CIO for a nationwide chain of hospitals and was once in charge of IT security for Fort Knox. He currently writes for as well as other TechTarget sites.

Step-by-Step Guide: Automating Backups
  Automating complex backups, part 1: Crash course on RSM
  Automating backups, Part 2: Creating a script to leverage RSM
  Automating backups, Part 3: Building on your script
  Automating backups, Part 4: The trick to scripting

Dig Deeper on Windows Server storage management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.