Overview

Details
..
Client Install / RIS
..
Drivers in RIS
..
Auto Server Setup w2k
..
Auto Server Setup w2k3
..
Application Distribution
..
MSI Tricks
..
Backup / Restore
..
Magic Boot Scripts
..
Magic Login Scripts
..
ADSI with Perl
..
User and Host Management
..
User Profile Management
..
License Management
..
Set ACLs from VBS

Downloads

Failures

Resources

Mailinglist

Cast & Crew
Real Men don't click
Automated backup
by Manuel Oetiker <moetiker@ee.ethz.ch> Andrei Kopovoi <copoff@ee.ethz.ch>

Windows 2000 comes with a backup software. Even though there is a flashy GUI, the tool works quite decently from the command line. We now do our Backups using a little batch script started from the Windows Scheduler. In Windows 2003 we use almost the same scripts except some little changes. These changes are mentioned in the code.

The backup goes to a samba share provided by our SAM-FS (Storage and Archive Manager File System) from http://www.lsci.com LSC Inc. (HSM system). We do this, using the backup to file feature. (no tape handling)

Policy Regarding User Data

Our policy is to store all user data except profiles on a samba (unix share) hosted on our many unix system. In our mixed environment we like to have all data in one save place. On the top of that, finding and restoring user files is faster if you can grep in a toc file. All windows clients have big disks, but because all contents on these disks has gone there by our automatic installation process, we do not backup client disks.

Backup

  • mount a samba share using:
    net use \\jabba\winbup /USER:winbup 'password'
    
  • Create and start a batch script like the example below:
    set bkpfldr=\\jabba\winbup\backup\%COMPUTERNAME%
    set backup=C:\WINNT\system32\ntbackup
    
    :BKPREG
    REM  date /t returns Day_of_Week, Month, Day and year in our
    REM  Win2000 installation.
    REM  This depend on a date format and we need a small trick
    REM  to extract the format from "date" command.
    
    for /f "tokens=1,2,3,4* delims=.:/- " %%i in ('date /t') do (
      for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
      set day=%%i&set %%x=%%j&set %%y=%%k&set yyyy=%%l))
    
    REM In win2003, date /t  does not return Day_of_week any more :
    REM
    REM for /f "tokens=1,2,3* delims=.:/- " %%i in ('date /t') do (
    REM for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
    REM  set %%x=%%i&set %%y=%%j&set yyyy=%%k))
    
    for /f "tokens=1,2* delims=: " %%i in ('time /t') do (
      set hh=%%i&set min=%%j )
    
    REM After this mess, we have min,hh,day,dd,mm and yyyy envariables.
    
    %backup% backup SystemState  /m normal /j "SystemState %COMPUTERNAME%"
    /f "%bkpfldr%\%COMPUTERNAME%-SYSTEM-%yyyy%%mm%%dd%.bkf"
    /D "SystemState %COMPUTERNAME%" /L:s /RS:yes
    %backup% backup c: /m normal /j "full dump C %COMPUTERNAME%"
    /f "%bkpfldr%\%COMPUTERNAME%-C-%yyyy%%mm%%dd%.bkf"
    /D "full dump C %COMPUTERNAME%" /L:s /RS:yes
    
    REM Set old to one month ago
    set mm=!%mm%
    set mm=%mm:!0=%
    set mm=%mm:!=%
    set /a mm=%mm% + 100
    set /a mm=%mm% - 1
    if %mm% equ 100 set /a mm=112&set /a yyyy=%yyyy% - 1
    set old=%yyyy%%mm:~1,2%%dd%
    del %bkpfldr%\%COMPUTERNAME%-SYSTEM-%old%.bkf
    
    REM This way not all System backup files will be deleted,
    REM for number of days in a month is different.
    REM Set old to the month before the last one.
    set /a mm=%mm% - 1
    if %mm% equ 100 set /a mm=112&set /a yyyy=%yyyy% - 1
    set old=%yyyy%%mm:~1,2%
    REM del %bkpfldr%\%COMPUTERNAME%-*-%old%*.bkf
    :end
    
  • umount the share:
    net use \\jabba\winbup /DELETE
    

Restore

To do a full restore of a windows 2k system you have to run a normal Windows install first.

  • Restore all the files with the "overwrite all" option. Actually, there is a special procedure for system state restoring of domain controllers. But if you have only one domain controller and do not need to replicate active directory data, then you can just choose system state restore mode after rebooting and restore the system state.
  • Not all files can be restored, as not all files are in the backup. You can see the list of missed files in
    "C:\Documents and Settings\Administrator\Local Settings
    \Application Data\Microsoft\Windows NT\NTBackup\data\backup*.log".
    

    You are supposed to restore the files somehow. The backup*.log files get overwritten rather quickly, so better copy them somewhere before you start a backup script.

We have tested this in a test environment and it looked good but we have not yet had the pleasure to try this for real. So we do not know what's going to happened after a real life restore. Knock on wood!

Dealing with long restore times

As the Windows 2003 ASR backup feature is crippled to be only usable through the GUI and our normal restore procedure (including an OS reinstall) takes 2-3 hours of work and even more downtime, we configure an additional on-line image-based backup on critical servers allowing for a fast restore onto the same or very similar hardware.

Problems with older SAMBA Servers

There was a a problem until Samba version 2.2.2, that files generated with ntbackup greater 4gb were broken and it was not possible to restore it anymore. We employed a person to find the bug in samba and he was successful. So after version 2.2.3 it is safe to have bigger files. We have at the moment 13gb files.

2001-06-09moInitial Version
2001-06-15toSpelling Update
2001-06-22moInsert the Script
2002-11-20moadd info about samba
2002-11-21acchange of the backup script, and restore procedure.
2003-01-09moSpelling Update thanks to Jim Davis
2006-02-24drsome additions regarding w2k3
2006-06-23masome additions regarding w2k3
Manuel Oetiker  //  2007-03-23  //  Copyright 2001, ETH Zurich