Utilizing the Built-in Windows Backup (ntbackup.exe) For Windows

This post is a record of what I’ve learned and done to make the built-in backup utility in Windows 2000, Windows XP, and Windows 2003 as useful as possible.

Often my clients, as well as most home users have operating systems like Windows 2000/2003 Server (or Windows XP for home users) installed and end up using a 3rd party application to backup their data. For servers, this can get expensive quickly, and often my clients don’t understand why they have to pay as much money (or more) for backups then they did for the server(s) it’s backing up (expensive software combined with expensive tape systems). With home users, or business workstations, they are very rarely backed up because of the complexity that they perceive it to be. Often, I believe the built-in backup utility of modern Windows could do the job just fine for small businesses and home, but many don’t know how to work with it, and deal with its limitations (and Microsoft doesn’t have a good wizard to walk you though the more advanced scenarios).

Three most common mistakes made in small business data backups

  1. Often companies just set an initial backup job and don’t review it until something breaks.
  2. Often companies don’t have off-site backups, and if they do, they are old or incomplete (not appropriate for their business needs).
  3. Often businesses never test their backups, or even look to see if they are successfully finished.

Advice Before Beginning

ntbackup hides in your start menu under Accessories>System Tools. It can also be run by the command ntbackup.exe from a command line or run prompt.

Establish a single computer as the “central backup computer” that will store the backup files from all computers. This keeps your sanity in check. It doesn’t have to be a Windows “Server” OS. If your going to “pull” all remote files from this computer (rather then “push” files to it from other computers), then disable file sharing in the properties of the network card (to help prevent attacks by viruses or hackers).

One thing you must do in order to limit the frustration of this program is to always run it backup jobs from a backup user account. If you are at home and only have one login, then using the existing login user is fine. But if you’re in an Active Directory environment then I suggest creating a special user called “backupuser” or “sysbackup”, etc. Give this user a strong password (more then 15 characters), and initially, add it to the Backup Operators Group. There are several reasons for this requirement:

  • Ntbackup.exe likes to dump its logs under the user’s profile it’s running at. We’ll talk more about logs later, but if you perform backup operations from different users, then you’ll have problems finding all the logs. We’ll show how to change this location later in the document.
  • Ntbackup.exe needs to run as a specific user. This user needs to have permissions to backup all files, which could be any account that is an admin. But, when that admin changes their password, or if they leave, etc, this account will not update itself and backups will fail. The account shouldn’t be person-specific, and should not have an auto-expiring password (which is why the password should be extra long and cryptic, so it’s hard to guess or “brute-force”).

How to Schedule Jobs

Ntbackup uses the Scheduled Tasks service (aka at.exe in 2000, schtasks.exe in 2003) to run its jobs. This is equivalent to the cron scheduler in UNIX. The ntbackup interface can be used to create a backup job, and will create a .bks file that is the configuration of all the files selected for backup. If you schedule jobs with the ntbackup interface, then it will add them to the Scheduled Tasks “folder” automatically according to the schedule you selected. All of this is hidden behind the interface so for a beginner, they can just select the files they want, select a location or tape to backup to, and go.

Where to find Backup logs

The Backup logs are under the profile of the user account that is used to run the backup job. So, if a username of “backupuser” was used, then the logs would be located:

C:\Documents and Settings\backupuser\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\

The .bks configuration files are also stored here by default if you create it from the ntbackup interface.

How to edit or create a backup config file (.bks) without using ntbackup

You can use the ntbackup GUI to edit, save and load existing .bks configuration files, but the files themselves are so simple that it’s often quicker to edit them in notepad.

Here are sample lines you could have as the contents of a .bks file

\\SERVER2\APPSHARE\
C:\
C:\WINNT\system32\wbem\repository\ /Exclude
K:\Lables\ /Exclude
K:\Janurary 29.doc /Exclude
DS \\SERVER1
IS \\SERVER1
JET SERVER1\Microsoft Information Store\First Storage Group\
SystemState

  • The 1st line backs up a network share from another computer
  • The 2nd line backups up the whole c: drive of the local computer. (doesn’t include the registry, AD, etc) By default ntbackup does everything in a directory including sub directories
  • The 3rd and 4th lines show how to exclude directories
  • The 5th line shows how to exclude a file
  • The 6th and 7th show how to backup an Exchange 5.5 directory store and information store
  • The 8th line show how to backup a local Exchange 2000/2003 database
  • The 9th line shows how to back up the system state. (later we will cover what is in a system state)

So, If I were to create a .bks file with notepad of my backup locations, call it “nightly network backup.bks” and put it in the “c:\scripts” folder I make, I can start constructing my other files needed for the backup job. To create the schedule for your job, you can use the command line, but I find the Task Scheduler easier to deal with and change. Here is the command line for a job that the ntbackup GUI will create:

C:\WINNT\system32\NTBACKUP.EXE backup “@C:\scripts\nightly network backup.bks” /d “nightly network backup” /v:no /r:no /rs:no /hc:off /m normal /j “nightly” /l:s /p “4mm DDS” /um /f “\\server-ts\backups\nightly network.bkf”

Notice I’ve specified which “backup script” to use, and where to store the actual backup file, neither of which has to be on the local computer. For a command line reference, use the help file included with ntbackup.exe (run “ntbackup.exe /?” to see it).

What Exactly The System State Backup Covers

When you backup the System State on a Domain Controller, the following is backed up:

  • Active Directory (NTDS)
  • The boot files
  • The COM+ class registration database
  • The registry
  • The system volume (SYSVOL)
  • The IIS metabase

When you back up the System State on a member server or workstation:

  • The Boot file
  • The COM+ class registration database
  • The registry
  • The IIS metabase

When Certificate Server is installed on your server, it is included in the System State.

What ntbackup Does NOT Backup

KB104169 It skips files that are not important, like the pagefile, the hibernate file, recycle bin, tmp files, etc.

How to Notify Yourself About Various Backup Events

Now that you know where the log files are stored, you can use Windows Scripting Host (WSH) to create a mail script in .vbs that will email you at the end of a job. I wish I had one handy to to show you. Blat would allow you to do this in a batch file with much less code (a single line).

How to Backup the System State of Multiple Machines

While it may be easier to buy an enterprise backup program at this point, if you only have 2-6 servers then it may still be more costly to buy then “orchestrating” your backups with ntbackup. I’ve seen two different working options in this case:

  • Semi-Centralized: Run backups on the other servers of just the system state to their local hard drives an hour in advance, and then pull those plus your file backups from your “backup server”.
  • Distributed: I find for the purposes of a restore, it’s easier to do full backups on each system, and point them to save the .bkf backup file on the “backup server” (note this would require file sharing to be enabled on the backup server). Doing it this way means you’ll need to setup a blat/email job on each server for it’s logs, OR a better option is to share out the log directory’s and “blat them” from a single batch job on the backup server.

Other Options for Performing Backups With and Without a Tape Drive on Small Networks

Perform nightly backups to disk, on a different server or pc, and perform weekly’s to tape. This is the disk-to-disk-tape scenario

Rather then buying bigger tape drives and tape autoloaders, use disk-based backups for onsite and tape only for offsite storage

Use an external USB/Firewire drive and rotate offsite to prevent ANY tape use. 500GB-1TB external drives are cheaper then tape drives, and hold 8-16 times the data of a single 4mm tape

For a offsite backup solution that is really cheap, fast, rather simple and effective; buy at least 2 external USB hard drives and pick a computer to be your “backup server”. Have this backup computer push/pull files daily to store the .bkf files on the USB drive. 1-2 times a week, swap out one drive for the other (use disk manager to ensure they use the same drive letter) and take the new “spare” one home. Now you have disk backups onsite, and offsite, likely for less then $500.

If you do all these things: weekly offsite, nightly backups to disk, and email reports of backups, you’ll have a very complete solution for small business backups that rival most small businesses today. The next step is for you to test your restore skills, but that’s another post.

Reference

How to Schedule Unattended Backups Using a Stand-Alone Tape Library

How to Save Backup Report Logs to an Alternate Location

  • http://mcwresearch.com Michael

    Holy crap this is a lot of info! Impressive.

  • http://www.fishbrains.com Bret Fisher

    Actually documented most of this in 2004, but never pulled it into a blog post until now :)

  • Hans Schwegler

    OK, my question has disappeared, you know I’m using ntbackup.exe for regularly creating an image of my system partition, but that operation requires a diskette at the end of that operation, so I thought, after reading your expert opinion on those complex backup routines, that maybe you’d know whether it’s possible to circumvent the diskette, now that many computers come without the diskette thing.

  • http://www.fishbrains.com Bret Fisher

    OK, so a backup and a ‘image’ are two different things. ntbackup.exe doesn’t image systems. Use imagex.exe, Ghost, Drive Image, etc. for that.

    Now what you’re probably talking about is the ASR (automated system recovery) disk, which is new to XP and Windows 2003 and I didn’t cover here. The old ERD (emergency recovery disk) died with Windows 2000. (Recovery deserves it’s own post or two) Search microsoft.com for ASR and ntbackup to get the details. This page has your answer, which is yes, and no. This page also has some good walkthroughs that talk about ASR.

  • Vasily

    Perfectly! But didn’t work :)

    When i make text bks file and give it to ntbackup nothing happen. I try to load selections in GUI from compiled “test.bks” file with a contents like that:

    –test.bks file begins–
    c:\
    c:\mp3\ /exclude
    –test.bks file ends–

    and ntbackups says – “no valid selections found in c:\…\test.bks”

    OS: windows 2000 sp4 server (5.00.2195)

    I try these method in win2k3 – nothing happens and GUI nothing says.

  • Vasily

    Detailed investigation shows, that ntbackup insert into bks file special simbol with hex code “00″ after each letter.
    I am insert that simbol (using hex editor) to my “test.bks” and it now works. But i think, that using GUI is a simplest way.

    (And Microsoft tells same: “You must use the GUI version of the Backup utility to create backup selection files.” in “Using batch files to back up data. Updated: January 21, 2005″)

    Here hex code of my new “test.bks”
    Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F
    00000000 43 00 3A 00 5C 00 0D 00 0A 00 43 00 3A 00 5C 00 C.:.\…..C.:.\.
    00000010 6D 00 70 00 33 00 5C 00 20 00 2F 00 65 00 78 00 m.p.3.\. ./.e.x.
    00000020 63 00 6C 00 75 00 64 00 65 00 0D 00 0A c.l.u.d.e….

  • http://www.jasonholden.com Jason Holden

    Using this on Windows XP SP2. Is there a way to run the backup silently without the GUI?

  • http://techonrequest.com Miriam Kerr

    This is a great, simple and concise explanation.

  • Gilbert

    Pardon my ignorance, but when selecting a directory to back up, how do I accommodate for the situation where the file names within that directory are created with new names..

    As I see it now, when I select the target directory, all the current existing files are selected, but new file will be added over the course of the day.

    So my base question is; how do I backup a directory and whatever content it has?

    Thank you,

  • Mark

    Gilbert, the system will backup anything in the directories that you select, provided you do not explicity ‘exclude’ them. As new files and folders are created under a selected directory to backup, they will be included in the next backup

  • Eric

    Hi, Do you know how can I restore a tape from another computer. The tape data was using NTBACKUP.exe as a backup tools. I insert the tape in another computer with a same tape drive, but the computer did not recogonize the tape in side the ntbackup.exe GUI.

  • ruth

    3)Often businesses never test their backups, or even look to see if they are successfully finished, you write.

    However, I don’t see how to open the back up file created to be sure that all my documents are inside. The only option on the wizard is to back up or to reinstall. Do you have step by step instructions on opening the backup file on the external hard drive where I have it stored and then viewing all the files that were backed up from My Documents?

  • Junction

    To add to last paragraph (…use diskmanager….) you can alternatively make sure you always have the right location by making a folder “backupdisks” and make a junction of the backupdisk or set a mount point. In this case you are absolutely sure that you have the right location. See http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html for more info on junctions/hardlinks.

  • Mark Melanson

    Vasily

    The .BKS file must be saved as UNICODE.

  • Stu Hill

    Ah! Many thanks Mark – that explains it :

    The .log file it writes to (in the local profile) is also UTF-16, which is why a linux machine wasn’t able to parse (or grep) the log files.

    The solution was to convert it to UTF-8 with :

    iconv -f UTF-16 -t UTF-8 infile.log > outfile.log

    Then remove the windows line endings with :

    tr -d ‘^M’ finalfile.log

    I’m sure there are much better ways to do it, but this works so thats good enough for me right now!!

    After doing this I am able to grep the backup.log file to check on the status from a linux script.

    Thanks for that little gem and helping me to unlock the solution.

  • http://www.volkerwessels.nl Bart

    Great blog…

    But i have a question i wan’t to make a ntbackup script for multiple clients ( Windows XP ). I wan’t to great a script that take the active username init for backuping the my documents folder. Is there any body how can tell me if this is possible.

    Thanks all ready foor helping me out.

  • William Dunworth

    When I backup my server using ntbackup.exe to an external drive it takes 11-12hr whereas novastor tape backup for same info takes 1.5hr what am I doing wrong

Subscribe

Twitter Updates