Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command-line backups no longer work 1

Status
Not open for further replies.

crobin1

MIS
Aug 22, 2002
381
0
0
US
Having fairly simple needs for backup purposes, under Windows 2000 I use NTbackup to backup most of our servers. To have some control over the process I use it in a scheduled batch file.

I use the /P switch to designate the tape pool to use, and the /UM switch to find the first available media in the pool for the backup. This works well and allows us to put in new tapes (as long as we format them) or used tapes and the backup works with no other intervention. Here is the exact command I use:
Code:
start /wait %systemroot%\system32\ntbackup.exe backup "@C:\backup\full1.bks" /n "%computername%-%dtt%" /d "daily %dtt%" /v:no /r:no /rs:no /hc:on /m normal /j "daily %dtt%" /l:s /p "DLT" /um

Now in Windows Server 2003 the /UM switch no longer works. It is not even documented in the help or KB, although you can put the switch on the command line and it won't generate an error. So far no matter what I've tried NTbackup won't look for any available tape, and it always complains that there is no available media.

I haven't yet tried using just the NTbackup GUI to setup and schedule the jobs, as I like being able to have the tape names automatically generated with the date, plus the batch file does other things such as temporarily stop antivirus programs and copy the backup log to a central location for review.

I may also look in to using RSM command-line to get the GUID of the current tape and have NTbackup use that, but that makes the script much more complicated and I was hoping to avoid that.

Has anyone else experienced this and gotten it to work?

 
Although the /um switch is not listed in the Windows Server 2003 ntbackup help file or on Micro$oft's website, it works fine in mine ;-)
The command line I used was:
C:\WINDOWS\system32\ntbackup.exe backup "@C:\Documents and Settings\Administrador\Definições locais\Application Data\Microsoft\Windows NT\NTBackup\data\Copia de Dados.bks" /n "Copia de Dados" /d "Copia de Dados" /v:yes /r:no /rs:no /hc:eek:n /m normal /j "Copia de Dados" /l:s /p "4mm DDS" /um
 
I'm glad it worked for you, but it never did for me. I finally found a sample script on Windows & .Net magazine's site, plus more information from Microsoft and Windows Server 2003 help, and got a script that works most of the time.

Basically I use several RSM commands and tape drive/tape GUIDs to check for a tape, format it if necessary, and then start the backup. If anyone is interested I can post the relevant code.
 
Crobin1,

I would like to see the relevant code you have used.

Also, do you know of a way to read the name of the tape currently in the drive so the name can be used in an append batch job?
 
You will probably need the GUID of the tape, as opposed to just the name, as NTBackup requires the GUID. Basically the first half of the script deals with getting this information. Also see the section that backs up to a previously used tape, to format the GUID.

Here is a pared-down version of our script:
Code:
@echo off
rem Info from various sources, including Windows & .NET Magazine and Microsoft

set tapeguid=""
set partguid=""
set logguid=""
set t1=""

rem Set the GUID of the tape drive, must be determined manually
rem Use: rsm view /tlibrary /guiddisplay /desc
set drvguid=FA1C9246A009449BB9527E6CA7C9414A

rem Refresh the RSM library
start /wait rsm refresh /lf"Compaq DDS4 20/40 GB DAT Drive"

rem Get the physical GUID of the tape in the drive
FOR /F "usebackq delims==" %%i IN (`rsm view /tphysical_media /cg%drvguid% /guiddisplay /b`) DO set tapeguid=%%i
rem Check to make sure there was a tape in the drive
if %tapeguid%=="" goto notape

rem Get the partition GUID of the tape
FOR /F "usebackq delims==" %%i IN (`rsm view /tpartition /cg%tapeguid% /guiddisplay /b`) DO set partguid=%%i
rem Get the logical media GUID of the partition; needed by NTBackup
FOR /F "usebackq delims==" %%i IN (`rsm view /tlogical_media /cg%partguid% /guiddisplay /b`) DO set logguid=%%i

rem If the tape is new, logguid will contain
rem this string: Unable to view information for all objects.
rem Due to some command-line oddities we take just the first 6 characters of
rem logguid to make the comparison
set t1=%logguid:~0,6%
if /i %t1% neq Unable goto oldtape

:newtape
rem Make sure the tape is in the Free Media pool
start /wait rsm freemedia /lg%drvguid%

rem Start the backup
start /wait %systemroot%\system32\ntbackup.exe backup "@C:\backup\full1.bks" /n "%computername%" /d "daily" /v:no /r:no /rs:no /hc:on /m normal /j "daily" /l:s /p "4mm DDS"

goto backend

:oldtape
rem Format the logical GUID as needed by NTBackup
set p1=%logguid:~0,8%
set p2=%logguid:~8,4%
set p3=%logguid:~12,4%
set p4=%logguid:~16,4%
set p5=%logguid:~20,12%
set bkguid=%p1%-%p2%-%p3%-%p4%-%p5%

rem Start the backup
start /wait %systemroot%\system32\ntbackup.exe backup "@C:\backup\full1.bks" /n "%computername%" /d "daily" /v:no /r:no /rs:no /hc:on /m normal /j "daily" /l:s /g "%bkguid%"

:backend
rem Eject the tape
start /wait rsm eject /PF"%computername% - 1" /astart
goto end1

:notape
echo No tape in the drive

:end1
exit
Some lines may get wrapped; all lines, especially the FOR commands and the actual backup commands, should be on a single line by themselves.

Hope this helps.
 
Well isn’t this interesting.

Since installing server 2003 on 2 of our domain controllers, we have had the same problem with the backups not working.

crobin1, thank you very much for the script you used to overcome this, but it only fixed the problem on one of our servers.

It turns out that I had to re-add the /UM switch to the script AND use the process you have to de-allocate and mark the media as free for this to work on the other server.

Now this seems extremely weird. Guedes said /UM worked perfectly for him but not for us. I first thought that it was because he may have upgraded to 2003, not do a clean install like I did. I have also applied the 822132 Hotfix, (
Both of our server have a clean install of server 2003 with the above Hotfix installed, both are DC’s and they are both the same model IBM server, they both use the same model tape drive and both have the same SCSI cards. Essentially, exactly the same. How then does the /UM switch work on one but not the other?

Neither servers worked with the following script “start /wait %systemroot%\system32\ntbackup.exe backup "@C:\backup\full1.bks" /n "%computername%-%dtt%" /d "daily %dtt%" /v:no /r:no /rs:no /hc:eek:n /m normal /j "daily %dtt%" /l:s /p "DLT" /um”. But when I modified the script to contain the changes Crobin1 suggested, it worked on one server but not the other. I then had to add the /UM to the script to get the other server to backup successfully.

Has anyone else come across this problem? This sort of inconsistencies drive me crazy!
 
I have tried all suggestions on our 2003 server, but nothin gworks other than starting that backup using the GUI...frustrating because I have such a simple sript that runs it on my NT servers.
Richard
 
One additional thing that helped our servers was adding the SLEEP command after the RSM REFRESH, like this:
Code:
rem Refresh the RSM library
start /wait rsm refresh /lf"Compaq DDS4 20/40 GB DAT Drive"

sleep 10
or some server/tape drive combinations prefer
Code:
rem Refresh the RSM library
start /wait rsm inventory /lf"Compaq DDS4 20/40 GB DAT Drive" /afull

sleep 10
(I'm not sure why on some a refresh will work, whereas on others a full inventory is required.) Since adding that we haven't had a backup failure unless the tape was brand new and not prepared. The SLEEP command is available in the Windows Server 2003 Resource Kit.

This is not original with me. I saw it somewhere in these forums, but have not been able to find the original post; if I could I would give that poster a star.
 
I used the gui to schedule my backup on an upgraded windows 2003 server and then added the /um command and now I don't even get an event log message that says the backup fails. If I check the scheduled tasks folder, it simply reads "could not start" under status. Any help out there?
 
Open the Scheduled Tasks folder, go to the Advanced menu and select View Log. See if there is any more information in there about why it failed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top