Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


September 2002

Scheduling Command-Line Win2K Backups

Automate backups on single-tape-drive systems
RSS
Subscribe to Windows IT Pro | See More Backup and Recovery Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

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.

End of Article

   Previous  1  [2]  Next  


Reader Comments
Excellent article.
I wish I'd seen it before. I've never been able to correctly schedule a backup since my migration to Win2K (of course, previous batch files didn't work anymore)
Thanks

Raymond Warichet August 22, 2002


I know this is oriented toward W2K, but does it apply to WXP as well, or have things changed yet again?

Tom Stewart August 27, 2002


This was useful, but doesn't address the issue of ejecting tapes for operators, this is explained at http://www.jsiinc.com/SUBE/tip2200/rh2265.htm

Also RSM is the 'Removable' Storage Manager.

Nick Swinney August 28, 2002


It would have been helpful to talk about the /UM switch. It stops prompts for user input. Essential to automating backups.

ryan ware October 01, 2002


Excellent! I've trying for two weeks to figure this thing out. One of the stumbling blocks appears to be a mis-print in the SBS Help file. It says the RSM View switch is "/guid_display" instead of the "/guiddisplay" that Mark has demonstrated...I could never get the thing to work. Mark's explanation is perfect!

Gavin Rumble January 11, 2003


Wonderfull !!!!
I can´t even imagine the work you had to discover all this !!
It works very well !!

Nuno Sobral January 21, 2003


How about to create Emergency disk? Can we schedule it?

Cora Li March 02, 2003


This article contains an example that doesn't work.

The option to exclude files or directories is /Exclude, not /exclude. Lowercase is rejected by ntbackup.

Peter Shute April 06, 2003


Good article clear and concise - easy to work with, unlike MS Windows Help Topics!

Eddie Martin November 06, 2003


Pretty smart I must say. Found this very useful. Thanx.

Sugeesh Ariyaratna November 06, 2003


 See More Comments  1   2   3 

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Windows 7 Sets Sales Record

Microsoft CEO Steve Ballmer described Windows 7's first ten days of sales as "fantastic" while in Japan yesterday. ...


Storage Whitepapers Turn to a Proven Server and Storage Migration Solution

The Impact of Disk Fragmentation on Servers

Take Control of Your Email: Understand the Business Reasons for Email Storage Management

Related Events Disk-to-Disk Grows Up

WinConnections and Microsoft® Exchange Connections

Check out our list of Free Email Newsletters!

Storage eBooks A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Keeping Your Business Safe from Attack: Encryption and Certificate Services

Related Storage Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement