The NTBackup utility comes with Windows NT, 2000, Server 2003, Small Business Server (SBS) 2003, and Windows XP. NTBackup is not installed by default with Windows XP Home Edition, but is available on the Windows XP installation disc. Microsoft has replaced NTBackup in Windows Vista.
NTBackup backs up files to a proprietary BKF format. With Windows XP and later, it can even backup open files using Volume Shadow Copy, aka Volume Snapshot Service (VSS)..
To create a backup process that runs every week on a specific day to backup a folder on a system, you can create a batch file similar to the following:
@echo off
REM NTBackup batch file for ACCI folder
REM Set date variable
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
date = %date%
ntbackup backup D:\ACCI /J "ACI" /V:No /M Normal /Snap:on /f "F:\ACI\Backups\Current\ACCI_Weekly_%date%.bkf"
The above batch file, which I've named acci-weekly.bat
will
backup the D:\backup
on the system on which it is run. The files
will be backed up to F:\ACI\Backups\Current\ACCI_%date%.bkf
. The
%date%
variable is set by the code below:
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
date = %date%
The %a
variable holds the
month, %b
holds the day, and %c
holds the year. Files
will be created with names in the form ACCI_Weekly_07-12-2008.bkf
.
The other parameters used are as described below:
/J {"JobName"}
Specifies the job name to be used in the backup report. The job name usually
describes the files and folders you are backing up in the current backup job.
/V:{yes | no}
Verifies the data after the backup is complete.
/M {BackupType}
Specifies the backup type. It must be one of the following: normal, copy,
differential, incremental, or daily.
/SNAP:{on | off}
Specifies whether or not the backup should use a volume shadow copy.
/F {"FileName"}
Logical disk path and file name. You must not use the following switches with
this switch: /P /G /T.
Further information on the options availabe with the ntbackup
command can be obtained by running ntbackup /?
from a command
prompt.
By specifying normal
as the backup type, all of the files
in the folder will be backed up. If the folder occupies a large amount of
disk space and will take a considerable amount of time to backup, you may not
want to backup all of the files every day.
In this case I would run a normal backup on Sundays, but an incremental
backup every other day. So I have a second batch file, acci.bat
.
@echo off
REM NTBackup batch file for ACCI folder
REM Set date variable
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
date = %date%
ntbackup backup D:\ACCI /J "ACI" /V:No /M Incremental /Snap:on /f "F:\ACI\
Backups\Current\ACCI_%date%.bkf"
To run the batch file that performs the incremental backup every day,
you can use the at
command.
C:\Documents and Settings\Administrator>at 19:30 /every:m,t,w,th,f,s d: \backups\acci.bat Added a new job with job ID = 1
The above command schedules the backup to run every night, Monday through Saturday, at 7:30 P.M. The backup is an incremental backup. An incremental backup is a backup that copies only those files created or changed since the last normal or incremental backup. It marks files as being backed up by clearing the archive attribute on files. If you use a combination of normal and incremental backups to restore your files, you will need to have the last normal backup and all incremental backup sets.
You can check scheduled jobs by running the at
command with
no parameters. You can get help on the command with at /?
.
C:\Documents and Settings\Administrator.mayberry>at Status ID Day Time Command Line ------------------------------------------------------------------------------- 1 Each M T W Th F S 7:30 PM d:\backups\acci.bat
To schedule the job that runs once a week on Sunday, I can use
at 19:30 /every:su d:\backups\acci_weekly.bat
.
For a full restoral from the backups, I would need to restore first from the weekly normal backup and then restore from each of the incremental backups from that week.