Tuesday, October 05, 2004

SBS 2003 Backup Hack

I wanted to write and share a Windows Small Business Server 2003 backup tip with my reader(s) (is it possible I have more than 1 yet?). Since I am somewhat active in the SBS community, and I tend to listen to our Most Valuable Professionals (MVPs), you can thank Wayne Small for asking questions about this. Wayne mentioned he wanted to backup to USB 2.0 hard drives during the day, and Tape drives at night. Interesting concept, I guess you can't be too secure with your backups right?

This got me thinking about my home setup, I have a tape drive and a USB hard drive: can I use both?

I wanted to backup to USB Monday through Saturday, then on Sunday, backup to tape (primarily so I could take the tape offsite on Monday morning). I quickly realized that adding a scheduled task to simply run NTBackup to tape wasn't going to display the backup status in the SBS Monitoring Reports. I needed another plan.

Outlined below is my solution that is currently implemented on my home SBS machine. Just to be clear, this procedure is not endorsed by Microsoft, or the SBS team.
The first step is to create some registry files that we can use to "toggle" the backup media.


  1. Configure SBS backup (using the wizard) to backup to the USB disk

  2. Export HKLM\software\Microsoft\smallbusinessserver\backup to BackupToDisk.reg and save this in the "%sbsprogramdir%\backup" directory

  3. Configure SBS backup (using the wizard) to backup to the Tape drive

  4. Export HKLM\software\Microsoft\smallbusinessserver\backup to BackupToTape.reg and save this to the "%sbsprogramdir%\backup" directory


The next step is to take advantage of these registry files. In my case, I ran the Backup Wizard and scheduled to disk 7 days a week. Next, I scheduled a separate task, following the steps below, for Sunday before the backup and Monday before the backup to toggle to Tape and then back again.

When you choose to toggle the backup media, schedule a task that runs the following command line: regedit /s "%sbsprogramdir%\backup\BackupToTape.reg" or regedit /s "%sbsprogramdir%\backup\BackupToDisk.reg" depending on which media you want to target.

That's all there is to it: hacky, but effective. Now the backup to disk and the backup to tape appear in the SBS Monitoring reports, and are easily monitored via email.

Finally, don't forget to attach the backup logs to the SBS Monitoring reports, so in the event you had a failure, you can just check what happened directly from your Inbox.



UPDATE
I wanted to update this article to reflect something Steven T. found when working on his own solution of this, and it's something that I just missed from the start. So thanks Steve!

One of the comments he had was around the "Last Log File ID" and "Last Backup ID" registry keys. We probably shouldn't be replacing those each time we flop between disk and tape. My suggestion would be to open both of the .reg files created above and remove these (using notepad) from the .reg file. Thus they will not be replaced each time the script runs.




26 comments:

Interprom Inc. said...

Awesome Sean. Keep this stuff up! Thanks from the community,

Gavin

kw said...

Thanks, Sean, We'll be testing this one out for sure!

Anonymous said...

I have a problem with not enough capacity on one tape for my backup. Each day I copy one of two files, one which backups the files and another that does exchange and the system state to C:\Program Files\Microsoft Windows Small Business Server\Backup\Small Business Backup Script.bks. While not an ideal situation, it means we have a backup.

Anonymous said...

Hi,

excellent. Thanks for the tip. Very useful.

Eddie Restore IT Ltd

Anonymous said...

Well, looks like you have more than one reader! ;-) BTW, however many you had looks like you've got one more, great site!

Anonymous said...

Right click > save as...

Thanks for the tip!

Reader #8

Anonymous said...

Hi Community !

Many thanks to this helpful solution, have it in use with an USB Disk solution, for changing betwin 2 USB disk every day.
kindest regards
Tom

Anonymous said...

there is a freeware wrapper for NTBackup - you can get it for free by joining the CADDTECHConsulting group at yahoo, and the zip file will be sent out immediately. There is also a one page user guide, and some scripts you can use for notification for backup success or failure.

http://groups.yahoo.com/caddtechconsulting/join

Run it from the command line or batch file exactly as you would ntbackup, including the exact same parameters. You can control verify on and off, log types of summary or full, backup types of normal, differential, copy, incremental, or daily, tapes, etc.

All results display exactly the same as the native SBS 2003 backup.

Anonymous said...

Nice tip. Actually, you have to sign up here:

http://groups.yahoo.com/group/caddtechconsulting/join

I had to look around the groups a little, but found it.

Program looks really great.

Anonymous said...

Have a slightly different problem and need some advice. The tape system supports compression and the tapes can handle 40gb uncompressed / 80gb compressed. However, it seems that its not compressing the data because when it reaches 40gb written it stops and reports errors in the logs. The amount of physical data to backup is just under 50gb so it should easily fit. The amount of physical data being excluded to enable the job to run is ~13GB. The physical size of the remaing files being backed up is ~30GB. That's only 43GB.

We verified the tape drive specs and the device parameters and everything says that compression is available and enabled.

So what gives??

Sean Daniel said...

very strange. The only thing I can think off off hand is that NTBackup only supports tells drives to use compression in a certain way, if the tape drive does not support that method, compression would not be used.

Have you tried backing up to tape using NTBackup only? Chances are you will see the same behaviour there, in which case you'd have to get a new tape drive to support compression, or 3rd party backup tools. :(

Might I advise that you get two or more USB 2.0 disks and backup to them. Even without the compression, the media is cheaper, and faster!

SydD said...

I used the SBS2003 wizard to backup to USB drive. When I run backup, it always stops after 4+ GB.

I've been backingup to tape for over a year with no such problem.

Did I miss something in the wizard? Why does it stop after 4GB? USB has 255 GB free. Is it because I'm placing the file in a folder on the USB drive?

Sean Daniel said...

whoops, you missed one thing, but it's not obvious, it's in the FAQ up on microsoft.com. you're probably backing up to a FAT32 drive where the limitation on a per file basis is 4GB.

Reformat your drive to NTFS and your 4GB limit problems should disappear!

Anonymous said...

Hi Community,

I am backup up several SBS servers to either USB or SATA tape drives. My problem is that the backup of the data (between 50 & 100Gb per server) takes quite a few hours, and as I can only run the backups after hours it normally finishes in the early morning. The SBS Backup starts verifying, and that takes until nearly noon to finish. I would like to turn the verify off but cannot find out how to do it. Anybody have any ideas?
Thanks
Jurgen

Sean Daniel said...

Unfortunately, this is not possible with SBS 2003, the command line that we call into NTBackup with is built ont he fly, and verification is always on.

Are you sure you are writing to a USB 2.0 device? I backup and verify 60gb in 4 hours total.

What else is the server doing during the night that would slow the disks down?

Unknown said...

Hi Jurgen and a big thanks to Sean! Great site and a big help :)

I have a SBS2003 site that has a 190GB backup to USB and it was taking too long to backup and verify (Starting 6pm and finishing around 10am the following morning - yes USB2 backup drive, RAID5 SCSI drives in server, pretty fast generally). Invariably I would get a failed backup email and message in SBS Reporting/Monitoring. Actually often the backups were catalog-able in NTBackup and the error may have been only a minor part of the backup having an error, however the whole operation would be flagged as failed... eg the default SBS backup includes Exchange Information Store, System State, all (non manually) excluded Files and folders (and because I foolishly added the non tech company representative as a recipient of server performance reports she now sees all this stuff that sounds scary like "cpu experiencing low level of idle time" and also backup failures)

Because of the constraints of the SBS Backup Wizard and wanting to shorten the backup operation time I elected to turn off the verify part of the backup operation... not my preferred option and not one I would be that happy recommending to others. However it has helped until I can get approval to migrate to a solution that can handle a 200GB+ backup. (If you want to know how to turn off verify: the bkprunner.exe file needs to be opened in a hex editor and modified very slightly, let me know if you cannot find that howto)

Also, I have a copy of the free SBS backup wrapper mentioned above. Pretty nifty. Let me know anyone if you want a copy.

Matt.

Ross said...

I know this is an old post but ...

Thanks for this Sean. I'm using this technique to not only set the registry but also to copy a custom "Small Business Backup Script.bks" file. I do System State, Exchange and shared folders daily and a full backup weekly.

There's a potential problem concerning the Last Backup ID number. Simply ignoring it can produce some weird results and cause the wrong file to be overwritten. I think SBS backup does the simple logical thing and adds 1 to "Last Backup ID". If the result is greater than "Backup Files" then it is reset to 1. That determines the file name it will write.

Say you have two backup destinations called A and B each with 3 backup files then if Last Backup ID starts at 1 it will write files A1 B2 A3 B1 A2 B3 A1 ... (A1 means file 1 on A etc). Maybe that's not too bad but if each had 4 files you would get A1 B2 A3 B4 A1 B2 A3 B4 A1 B2 ... so A only ever has 1 and 3, B only has 2 and 4.

I've solved this by setting Backup Files = 1. The backup only ever writes bkf file number 1. I do the rotation in my own script. The script that runs before the backup doing the .reg and .bks stuff also rotates the files with a series of if exist ... ren ... statements. I also have script after the backup that does a dir into a file on the backup directory. That file gets included in the daily email report so I can check that the rotation etc is working correctly.

Ross

Sean Daniel said...

You have reverse engineered the backup files # correctly. (Although you also could have asked. ;o) )

Your problem solve seems to work fine also.

Glad I could help

Let me know if I missed a question...

Z Technology Services said...

Matt wrote on 7/24/07 (If you want to know how to turn off verify: the bkprunner.exe file needs to be opened in a hex editor and modified very slightly, let me know if you cannot find that howto)

Also, I have a copy of the free SBS backup wrapper mentioned above. Pretty nifty. Let me know anyone if you want a copy.


This sounds exactly what I need. I do not know how to get a hold of Matt or this information he mentioned. Any and all help would be GREATLY appreciated

Also a big thanks to Sean for having this blog for us normal users

Z

Anonymous said...

Hi can anyone send me a copy of the free SBS backup wrapper mentioned above. I have joined yahoo group caddtechconsulting and I’m awaiting confirmation. I suspect it may be Monday until I receive a response and I could do with the SBS backup wrapper today as I have the time to implement it out of working hours.

Thanks to any one in advance

Regards
Wayne

Anonymous said...

Great tip. I have just manage to setup this for one of my clients who required a backup during the day.

Junkbox said...

whaaaaaaaaat?....

thats simply awesome.

Hacky, yes.

I'm hitting New Egg right now to stock up on 250GB drives.

Anonymous said...

I really want to crack the normal/differential backup issue which seems to be locked in the code of the bkprunner. I know I can manually schedule tasks to run ntbackup, but I want to plug in to the SBS console and reporting.

I am currently looking at writing my own bkprunner that works off the registry entries from the SBS wizard and updates the XML so the results appear in the console.

I think I am a fair way on with this, but wondered if you'd give a bit more insight into what bkprunner does apart from simply calling ntbackup.

I'm fine with the file logging, calling ntbackup and updating the XML. I understand it also needs to enable the backup user and reset the password then disable it. Also, presumably it sends an email at the end of the process?

Is there anything else that should be incorporated?

Thanks!

Sean Daniel said...

Hi Iain,

My memory is a little hazy here, but I believe you have it all:
- enable backup user
- reset backup user password
- kick off NTBackup as the backup user
- stick the log files together
- disable backup user

I can't think of any other magic it does. Best of luck!

.... and do realize this is not a completely supported scenario. :)

... additionally, you may want to keep a copy of the original file.

Anonymous said...

As the author of the SBS Backup wrapper mentioned above, I have now posted a link to that program on my website:
http://www.caddtechconsulting.com

There is no longer a need to register at the Yahoo! group. This program still works for SBS 2003, which is now getting a little old.

There may be some other admin scripts posted that may be of interest.

Unknown said...

Thanks for taking the time to share such a nice information.
ddl software download