NT Backup
Using NTBACKUP Supplied
With every Windows NT
License
Define Critical
Apart from your database
files, very small percentage of what you have on your server is
critical. A WinZip installation on your NT server does not
qualify as a critical application. You can always reinstall it
without sacrificing anything. An examples of critical files
will be:
User/Developers' Files Kept on
Server
System Registry Files
Database Files
Web Server Files/Log Files
Keep
Your Windows NT System Configuration
Current
Keeping your
registry files current will save you a great deal of trouble
later. Run RDISK utility every time you have
installed/uninstalled any software or upgraded the hardware.
After the hardware upgrade, give yourself a day or so to see if
your hardware upgrade was stable or not.
Choose Update
Repair Info option. Create Repair Disk is a useless option
unless you have a server with nothing on it. Most of the time
the size of registry files is more than what a 1.44" disk can
take. Many of us forget to run this utility and there comes a
time when we choose "Last known good configuration option" from
the startup and realize that our server configuration resembles
a lot like how it was when they first installed it.
You can run the
Rdisk (Update Repair Info) option using batch file with the
following command.
RDISK
/S-
Keep Your Registry
Files Backup Ready
Most of the
important registry files are in use when the server is running.
Most backup software will simply ignore the files and move on.
There are some which claim to backup open files. Well, don't
bank on it. You must create an offline backup copy of your
registries somewhere else on the disk, which can be backed up
daily. To create an offline backup copies of your registries I
highly recommend to invest into Microsoft Resource Kit. The
resource kit is sold separately for the server and workstation
(I don't know why). Resource kit (both server and workstation
versions) come with a utility, REGBACK. This utility can backup
the entire registry or just a hive to a disk location. I use
the following sample batch file every night to backup the
registries for Server1.
DailyRegBack.bat
del F:\regbkp\Server1\*.* /q
regback F:\regbkp\Server1
del
\\Server2\f$\regbkp\Server1\*.* /q
regback \\Server2\f$\regbkp\Server1
The batch file not only backs up the registry
to a local drive, it creates a backup registry on Server2. This
batch file is scheduled to run at 10:00 PM every night. While
you are exploring the Resource Kit, check out the Command
Scheduler. It is a GUI version of the AT command to schedule
jobs.
Do Not Waste Time to Wait for Open
Files It is likely that most of the open
files during backup will not close within 30 seconds. For
example, index server files are supposed to be opened
while the service is running. NTBackup waits for 30
seconds for each open file. If you add this time up for
every opened file, it comes to a substantial period.
You can modify the following registry entries
to adjust the skipped files options:
HKey_current_user\Software\Microsoft\Ntbackup\User
Interface
Name: Skip open files
Type: REG_SZ
Definition:
0 = do not skip, wait
1 = skip files that are opened unreadable
2 = wait on open files for "Wait time"
Default
is set fot 2. Change this value to 1.
Do
Not Ignore the Open
Files
We somehow need to back the open files too. The
only way to close the open files is to close the program which
is opening them. A bit of guess work may be required. Some of
the Microsoft Software and database related software files are
easy to figure out. Figuring out the source of opened files
from one of your home grown application may be a problem.
There is a utility to determine the source of
open files. This shareware utility tells you who has a
particular file open, find it at:
http://www.sysinternals.com/
For database backups try to use the vendor
supplied backup software. Most database vendors (I know of SQL
Server and Oracle) come with a tape backup utility. The utility
can backup the database safely to a tape even when it is
opened. This is one instance where my rule, "Do not trust the
software proclaiming to backup open files" does not apply. The
reason is simple, database backup software does not take file
system backups. Rather, it reads the database dictionary and
the data like an application and writes it in a proprietary
format. I do recommend the following for the "extra careful"
types. If you have a lot of disk space, schedule disk dumps of
the database. MS SQL Server (6.5) disk dumps can be schedules
from SQL Executive. You can back these dumps using NTBackup.
Schedule these dumps well before your NTBackup starts.
Depending upon the size of the database the database dumps may
run for some time. For services/applications which do not fall
into this category, you have no choice but to shut them down
before the backup starts. To minimize the downtime for those
mission critical services, shut them down right before backing
up those folders where the opened files reside. Use the NET
START and NET STOP command to stop services. At this point I
would like to mention another great utility supplied with the
Resource kit, NETSVC. This utility can remotely start or stop
services running on other servers. The following example
illustrates its usage.
netsvc "FTP Publishing Service" \\Server1
/stop
ntbackup backup z:\Inetpub\WebDatabases /a /d "Server1
e:\Inetpub" /hc:on /l "d:\BkpLogs\%1.log" /e
netsvc "FTP Publishing Service" \\Server1 /stop
Backup Your Critical Files Every
Day
We must backup all the critical files by
applying all the techniques above. You should schedule
daily tape backups to backup all critical folders on local and
remote servers. You should shutdown services as needed
and restart them after the backup is done. The following
batch file will show you some tricks I use to backup my
servers. The batch file takes the tape id as an
argument. I give each tape a unique ID most likely
coinciding with the day the tape is used. For example a
DDS2 tape used on the 24th of every month is named as
DDS2-24. A well thought out scheme for naming your tapes
is important in the event you want to recover the data.
The output of the NTBackup is written to <TapeId>.log
file. Overall progress is written to
DailyBackup.Log file. Once your backup strategy is stable
you need to look at DailyBackup.Log file only to determine how
your backups are going. I have scheduled this file to run
every day. There are actually 31 entries in the schedule
for each day's run as the argument (Tape ID) passed to the
batch file is different every day. Little program called
NOW.EXE is supplied with the resource kit. It is a
character mode application which displays the current date and
time on the console (Command Prompt).
rem Use
this batch file to perform daily backups.
rem Arguements passed to the batch file: TapeName
rem We will be using DDS2 tapes for daily backups.
rem All DDS tapes are named as DDS2-1 DDS2-2 and so on.
rem Use the number after the dash to indicate the day of the
month.
rem Supply full tape name as the arguement.
rem
Backup logs will be stored on D:\BkpLogs
rem The
backup will be a multi steps process.
rem First map the drive to be backed up.
rem Shutdown the services (If necessary)
rem Perform the backup.
rem Start the services (If you shut them down before)
rem Disconnect the drive.
if
"%1==" goto err1
rem Do
the following only once. Just in case if the last backup
failed.
net use z: /d
now
>> d:\BkpLogs\DailyBackup.log
echo ....Starting daily backup >>
d:\BkpLogs\DailyBackup.log
rem Backup Server1
now
rem This is the first set it must not have /a option
rem Missing /a option starts the first backup from the
beginning of the tape.
net use z: \\Server1\c$
ntbackup backup z:\bat
/d "Server1 c:\bat" /hc:on /l "d:\BkpLogs\%1.log" /e
net use z: /d
rem
These are the following sets. They must have /a option
net use z: \\Server1\d$
ntbackup backup
z:\IntDevProjects /a /d "Server1 d:\IntDevProjects" /hc:on /l
"d:\BkpLogs\%1.log" /e
net use z: /d
net use
z: \\Server1\e$
now >>
d:\BkpLogs\DailyBackup.log
echo
....Stopping Server1 IIS services >>
d:\BkpLogs\DailyBackup.log
netsvc
w3svc \\Server1 /stop
netsvc "FTP Publishing Service" \\Server1 /stop
netsvc "Site Server LDAP Service" \\Server1 /stop
netsvc "Microsoft SMTP Service" \\Server1 /stop
ntbackup backup
z:\Inetpub\WebDatabases /a /d "Server1 e:\Inetpub" /hc:on /l
"d:\BkpLogs\%1.log" /e
ntbackup backup z:\Inetpub\Weblogs /a /d "Server1 e:\Inetpub"
/hc:on /l "d:\BkpLogs\%1.log" /e
netsvc
w3svc \\Server1 /start
netsvc "FTP Publishing Service" \\Server1 /start
netsvc "Site Server LDAP Service" \\Server1 /start
echo
....Starting Server1 IIS services >>
d:\BkpLogs\DailyBackup.log
netsvc
"Content Index" \\Server1 /stop
rem The files may be in use in Inetpub backup. Refer to prior
backups for good files.
ntbackup backup z:\Inetpub /a /d "Server1 e:\Inetpub" /hc:on /l
"d:\BkpLogs\%1.log" /e
netsvc "Content Index" \\Server1 /start
ntbackup backup z:\Devlp /a /d
"Server1 e:\Devlp" /hc:on /l "d:\BkpLogs\%1.log" /e
net use z: /d
REM
Backup other machines here
now >>
d:\BkpLogs\DailyBackup.log
echo ....Finished daily backup >>
d:\BkpLogs\DailyBackup.log
echo .... >> d:\BkpLogs\DailyBackup.log
goto
eoj
:err1
echo You must supply a tape name
:eoj
rem Over
Perform
Full Backups, Too
A complete backup of your system will
beat a daily critical files or an incremental backup any
day. The trouble is that the full backups take too
long and too many tapes. Depending upon your resources
and the size of the tape drive, perform a full backup of your
servers at least once a week. You can use some of the
ideas from the batch file above.
This article is by Ashish Kumar of Jagat Technology,
Inc.
|