Recipe 19.1. Performing a Backup


Problem

You want to perform a backup of your system using the built-in application for Windows XP.

Solution

Using a graphical user interface

To back up the contents of your machine to a file or to another removable media device:

  1. From the Start Menu, select All Programs (or just Programs if you're using the classic Start menu) Accessories System Tools Backup. The wizard starts by default. Click the Advanced Mode link.

  2. Navigate to the Backup tab, and then select New from the Job menu.

  3. Click the box to the left of a file or folder to select the files and folders you want to back up.

  4. In Backup destination, choose File (the default selection) if you want to back up to a file on disk. Choose another device if you want to back to a tape or something similar. You currently cannot back up to CDs.

  5. In Backup media or file name, if you are backing to a file, choose a location for the backup (.bkf) file. Otherwise, choose the tape you want to use.

  6. Make sure you've configured this backup operation the way you want by selecting Options from the Tools menu and verifying the choices there.

  7. Click the Start Backup button, and then make any changes to the Backup Job Information dialog box.

  8. Click Advanced to configure options like compression and verification. Then click OK.

  9. Click Start Backup.

Using a command-line interface

To back up to a file or tape, use:

> ntbackup backup [systemstate] "@FileName.bks" /J "JobName" [/P "PoolName"]  [/G "GUIDName"] [/T "TapeName"] [/N "MediaName"] [/F "FileName"]  [/D "SetDescription"] [/DS "ServerName"] [/IS "ServerName"] [/A] [/V:yes | no]  [/R:yes | no] [/L:f | s | n] [/M "BackupType"] [/RS:yes | no] [/HC:on | off]  [/SNAP:on | off]

See the discussion section of this recipe for some examples of the command-line functions in use in common situations.

Discussion

NTBACKUP can perform several different types of backups:


Copy

Copies all selected files but does not mark each file with a cleared archive attribute. Copy backups can be performed completely independently of other backup procedures without affecting their sets.


Daily

Backs up all files modified since the previous day. With a daily backup, the archive attribute is not cleared.


Differential

Copies new files and other files modified since the last normal or incremental backup. It does not mark files as having been backed up. To restore a complete backup, you'll need the last normal backup (covered later) in addition to the last incremental backup.


Incremental

Backs up files created or modified since the last normal or the last incremental backup. It does mark files as having been backed up. To restore a complete backup, you'll need the last normal backup (covered next) in addition to the last incremental backup.


Normal

A normal backup (sometimes called a full backup) copies all selected files and marks each file as backed up. You create these to start a backup scheme, and use them in conjunction with differential and/or incremental backups, depending on what you choose. Normal backups can be used independently; they don't require another accompanying set.

If you issue NTBACKUP from the command line without any parameters, Windows will launch the GUI for the Backup applet. If you specify parameters for NTBACKUP from the command line, the GUI isn't launched and the program runs entirely from the command shell.

Table 19-1 explains the variable options for the command line NTBACKUP program.

Table 19-1. NTBACKUP command-line options

Option

Explanation

@FileName.bks

Specifies the name of the backup selection file (.bks file) to be used. The @ character must precede the name of the backup selection file. The .bks file must be created using the GUI version of NTBACKUP and is essentially of summary of what a particular job is supposed to back up.

Alternatively, you could supply the path to the drive or file to back up, for example, D:\.

/J "JobName"

Specifies the job name to be filled in the postbackup report.

/F "FileName"

If you back up to a file, this specifies the path of that file.

You cannot use the /P, /G, and /T switches when using /F.

/T "TapeName"

If you back up to a tape, this specifies to tape to which to overwrite or append data.

/P "PoolName"

If you back up to a tape, this specifies the media pool to use. This is usually a subpool of the media specified with the /N switch.

You cannot use the /A, /G, /F, and /T switches when using /P.

/G "GUIDName"

If you back up to a tape, this specifies to tape to which to overwrite or append data.

You cannot use the /P switch when using /G.

/N "MediaName"

If you back up to a tape, this specifies the new tape name.

You cannot use the /A switch when using /N.

/A

If you back up to a tape, this specifies to perform an append operation.

You must use either the /G or /T switch when using /A. You cannot the /P when using /A.

/D "SetDescription"

Specifies a label for each backup.

/V:yes | no

Specifies whether to perform a verification pass when the backup is complete.

/R:yes | no

Restricts access to the tape to members of the Administrators group only.

/L:f | s | n

Specifies the type of log file to be written. f indicates a full file, s indicates a summary, and n instructs NTBACKUP not to write any logs.

/M "BackupType"

Specifies the type of backup. Replace "BackupType" with one of the following: copy, daily, differential, incremental, or normal.

/RS:yes | no

Backs up the migrated data files located in Remote Storage. (This is also backed up when you select the system root folder to be included in a job.)

/HC:on | off

If available, uses hardware compression for the job.

Systemstate

Includes system state data (Registry and other critical system information) in the backup.


There are two important limitations of NTBACKUP from the command line: one, you cannot restore files from the command line, and two, you cannot back up system state data on a remote computer.

Switches /V, /R, /L, /M, /RS, and /HC default to the setting in the GUI version of the Backup applet unless you explicitly set them on the command line.

There are some considerations if you use either Removable Storage or Remote Storage. You should make a note to back up the contents of systemroot\System32\Ntmsdata and systemroot\System32\Remotestorage on a regular basis. If not, then it's possible (although somewhat unlikely) that Removable/Remote Storage data could be lost and unrestorable.

The files that NTBACKUP creates are very large when compared to commercial products such as Veritas BackupExec. Keep that in mind when justifying the cost of sticking with the built-in product versus investing the money in a third-party backup product how much might additional storage cost you?

Command-line examples

The first example executes a normal backup named Nightly of the c:\mydocs directory. This example selects media from the Tapes pool and names the tape Nightly NTBACKUP 1. The description of the backup job is "Standard evening backup." A verification pass is done, access to the tape is open to all, only a summary log will be produced, hardware compression will be used, and Remote Storage data is not backed up.

> ntbackup backup c:\mydocs /m normal /j "Nightly" /p "Tapes" /n "Nightly NTBACKUP  1" /d "Standard evening backup" /v:yes /r:no /l:s /rs:no /hc:on

The next example starts a copy backup named Lunchtime of the E drive on the machine itself. The backed up files and folders are appended to the tape named Nightly NTBACKUP 1. Since no other switches are present, the default settings in the GUI version of Backup are used:

> ntbackup backup e:\ /j "Lunchtime" /a /t "Nightly NTBACKUP 1" /m copy

The following example performs a backup using the GUI Backup program's current setting. The program looks at the file weekend-backup.bks, located in the C:\Program Files\Windows NT\ntbackup\data\ directory, to select the particular data to back up. The backup job is named Weekend and it overwrites the tape named Weekend NTBACKUP 1 with the new name Weekend NTBACKUP 2. It also includes system state information:

> ntbackup backup systemstate "@C:\Program Files\Windows NT\ntbackup\data\ weekend-backup.bks" /j "Weekend" /t "Weekend NTBACKUP 1" /n "Weekend  NTBACKUP 2"

The final example backs up a particular directory to a file named backup.bkf using the Backup program's default values for the backup type, verification setting, logging level, hardware compression, and access restrictions:

> ntbackup backup c:\xpckbk /j "To File on MWF" /f "E:\backup.bkf"

When running this command again, to simply append another backup to the existing file, simply add the /a switch, as shown. Otherwise, you will overwrite the existing file automatically:

> ntbackup backup c:\xpckbk /j "To File on TH" /f "E:\backup.bkf" /a

See Also

MS KB 283592, "No Error Message Appears to Explain Why NTBackup Does Not Start from the Command Line," MS KB 283547, "Cannot Find Windows NTBackup Folder and Catalog Files in Windows XP," and Hack #96, "Build a Better Backup Strategy," in Windows XP Hacks (O'Reilly)



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net