Subscribe to Windows IT Pro
August 19, 2002 12:00 AM

Scheduling Command-Line Win2K Backups

Automate backups on single-tape-drive systems
Windows IT Pro
InstantDoc ID #25961
Rating: (4)
Downloads
25961.zip

To determine what type your tape is, first—if you've never done so on your system before—start Backup (click Start, Programs, Accessories, System Tools, Backup), then close it. Next, right-click My Computer, select Manage, and navigate to Storage\Removable Storage\Media Pools\Backup. You should see one or more folders, and one of those folders' names is your tape type. My system, for example, has a folder named DLT under Backup. If you see no folder under Backup, RSM doesn't have a driver for your tape drive.

Thus, if I have a 4mm DAT tape whose type shows up as 4mm DDS, I would use the following command to tell NTBackup to wipe whatever is on the tape and do a full backup of my files:

ntbackup backup @c:\files.bks
  /v:yes /hc:on /m normal /l:f
  /p "4mm DDS" /um

I'd put that command in my batch file and tell at.exe to run that batch file every Monday morning.

Next, I want to tell the system to do daily differential backups to the same tape the rest of the week. To append backups, you use the /g option instead of the /p "tapetype" /um syntax:

ntbackup backup @c:\files.bks
  /v:yes /hc:on /a /m differential
  /l:f /g "<guid>"

where guid is the tape drive's globally unique identifier (GUID). Win2K is rife with GUIDs. Each removable storage device gets a GUID, and every tape that you format on a Win2K system gets a "physical media" GUID. Like hard disks, each tape has partitions—typically one per tape—and every partition gets a partition GUID. Within that partition is one "logical media," which gets a logical media GUID. NTBackup needs that logical media GUID.

Acquiring that GUID is the stumbling block in the otherwise simple process of building the batch file. To fetch GUIDs, you use the Rsm View command:

rsm view /t<object-type>
  [/guiddisplay] [/cg<guid>]

Choices for object-type include library (to list your drives), physical_media (to show the tapes in a drive), partition (to get the tape's partition) and logical_media (to show the tape's logical media). The /guiddisplay parameter lists objects and their GUIDs. The /cg parameter lets you specify what object you want to examine; guid is the object's GUID. To find the GUID of your tape drive, type

rsm view /tlibrary /guiddisplay

RSM will probably list several drives. The 32-character string to the right of your tape drive's name is the drive's GUID.

Then, create the diff.cmd batch file that Listing 1 shows. Locate the line that corresponds to callout A in Listing 1 and replace the string that follows the equal sign (=) with your drive's GUID. This GUID will never change. (Logical media GUIDs change every time you erase the tape, but diff.cmd handles those changes.)

Ugly as it is, diff.cmd is fairly simple. It uses the drive's GUID to ask RSM for the GUID of the tape that's in the drive, uses the tape's GUID to find the tape partition's GUID, then uses that GUID to get the logical media's GUID. Diff.cmd reformats the GUID to the format that NTBackup requires by adding hyphens in certain places in the GUID string (e.g., E30ADF03-E801-4BA4-BB82-4AD69B39FBE7).

Before I finish, let me pass along three Win2K NTBackup anomalies. First, typical backups have a bug that causes them to fail to reset archive bits on random files. (Let's hope for a Service Pack 3—SP3—fix.) Second, NTBackup won't back up to CD-R discs, CD-RWs, DVD-RWs, or similar drives. And third, you can use the command line only to back up; to restore, you must use the GUI.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Mar 28, 2005

    As always, Mark Minasi rules!

  • Anonymous User
    7 years ago
    Mar 01, 2005

    Concise and well written. Why can't the technical writers at Microsoft ,who are partners with the creators of the software discussed above, do as good a job of explaining the syntax and creating useful examples?

  • Anonymous User
    8 years ago
    Nov 21, 2004

    The batche file is OK but I'm heving problems runnig that batche file on scheduled bases, when I try to run it by my self it runs without any problem but scheduled it dosent start????

  • Anonymous User
    8 years ago
    Oct 30, 2004

    See a couple of comments about ejecting the tape. I don't want to write a whole article here, but some quick tips that should get you going:

    Ejecting the tape requires that you script a RSM command in your batch file. Specifically:

    rsm eject /pf "name of you bacup tape" /astart

    Watch out for these issues:

    1> You must know the name of the tape that you are creating, since rsm eject will not simply eject the tape in the drive even on a single tape system (big change from NT4!). What this means is that you must specifically name your tape with the /n switch on your backup job. I capture the date to a variable (which I call now) so that I can have unique tape names. Why not just use %date% instead of creating a new variable? That is because %date% may not be the same when you start the job as when you finish it.

    2> The second thing to watch out for is that rsm will append " - 1", " - 2", etc. at the end of the tape name if you have duplicates names. It also appears that rsm will add these on if you run multiple (appended) jobs to the same tape.

    Hope this helps!

  • Anonymous User
    8 years ago
    Oct 18, 2004

    A very clear help file, much better than Windows help file. Thaaaaaanks

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.