The ntbackup command
activates the ntbackup GUI and, unlike with all other commands covered in
this chapter, you cannot select what to back up with the ntbackup command itself. You have to select that from the GUI; however, you
can run the GUI once, select what files to back up, and save that to a .bks file you specify on the command line later.
As with the other tools covered in this chapter, this section is not meant to
replace the help page for ntbackup. It has many other
options not covered here.
In addition to selecting which files are going to be backed up, you can also select
values for a number of other options:
Type of backup (normal, copy, differential, or daily)
Type of target (disk or tape)
Name of target (for example, f:\backupfile.bkf )
Append or overwrite existing backups on target
Logging level (verbose, summary, or none)
These options can be specified as options on the command line or in the ntbackup GUI and saved as part of a .bks file. However, since you have to run the ntbackup GUI to create an ntbackup setup,
we won’t cover the command-line switches in detail. Instead, we’ll show you how to get
Windows to automatically create the command you need to run.
1. Creating a Simple Backup Configuration
To create a simple backup with ntbackup, you
need to create a backup options file using the ntbackup GUI, save it, then specify that options file when performing an
ntbackup backup. Start the ntbackup GUI by typing ntbackup at the
command prompt or by selecting Start→All Programs→Accessories→System Tools→Backup. From
the Backup tab, select drives or directories to back up. Please note that you can back
up the System
State as well.
Next, you need to select various options about the backup. The two primary choices
are the type of backup and where it will go. The available backup types are normal,
copy, differential, and daily:
Back up the selected files and mark them as backed up.
Back up the selected files but do not mark them as backed up.
Back up the selected files if they have changed since the last backup and do
not mark them as backed up.
Back up the selected files if they have changed since the last backup but do
not mark them as backed up.
Back up only the files that were modified today.
To select something other than the normal backup type, select Tools→Options→Backup
Type. While you’re in the Options dialogue box, browse the other tabs to see if you want
to change any of those options as well. Click OK to close this dialogue box.
You then need to select whether or not you’re going to use disk or tape. Disk is
probably the best option for a simple backup, especially if you just want to back up to
a share that’s going to be backed up by another process. You then need to select a
filename for the backup file. Once you’ve selected these options, select Job→Save
Selections As, and save the options to a filename that you record, such as c:\mybackup.bks.
2. Executing Your Simple Backup
To run the backup you created, you’ve got three choices. The first
choice is to simply click Start Backup in the ntbackup GUI. You can also run it from the command line if you’ve saved the
options to a file. The following command assumes that you didn’t select any options
other than which files to back up and specifies all of the important options as
arguments to the ntbackup command. It backs up the
files you selected and saved as c:\mybackup.bks,
gives the job the name “Daily Backup,” and backs the data up to the file F:\backup.bkf.
C:\ ntbackup backup "@C:\mybackup.bks" /M Normal /J "Daily Backup" /F "F:\backup.bkf"The next choice is to create a scheduled task with this command in it. If you’d
rather let Windows figure out all the command-line switches for you, you can simply use
the ntbackup wizard to create the scheduled task.
Once you’ve opened ntbackup, select the Schedule Jobs
tab, select a date on the calendar, and click Add Job. Select the items you want to back
up in the “Items to Back Up” dialogue box. The next dialogue box asks you to select a
destination directory and filename, and the next screen asks you to select a backup
type. The following screen gives you some other options, including whether or not to
verify the data after it’s been backed up. You can then specify whether or not this
backup should append to or overwrite any backups already on the destination. Finally,
you’re asked to name the job and create a schedule of when it should run. Once you’ve
done that, Windows creates a scheduled task with the appropriate commands in it. The one
I created during my example looks like this:
C:\WINDOWS\system32\ntbackup.exe backup "@C:\mybackup.bks" /a /d
"Set created 3/12/2006 at 8:35 PM" /v:no /r:no /rs:no /hc:off
/m normal /j "mybackup" /l:s /f "C:\Backup.bkf"
ntbackup can also be used to back up and
3. Restoring with ntbackup
You cannot restore
from the command line using ntbackup. What you can do
is start ntbackup and select the “Restore and Manage
Media” tab. Displayed in this window is a list of backups that ntbackup knows about. You can select any of the backups in this dialogue
box, and you’ll be presented with a tree of the files that are in that backup. You can
then select which files you want to restore, decide whether or not to restore the files
to their original location or another location of your choosing, and tell ntbackup to restore them by clicking Start Restore. You’re
then given a choice to select advanced options; the restore starts when you click OK. It
really doesn’t get much easier than this!