BITS – A New PC Imaging Model
Download
Report
Transcript BITS – A New PC Imaging Model
Using BITS to Transfer Ghost Images
Tim Leamy
IET – Academic Technology Services
UC Davis
UCCSC 2009
Outline
Why?
Background & History
Win9X
WinXP – initial attempts
Two partitions
BITS
Image creation overview
Details
Windows
FreeDOS
Initial PC setup
UCCSC 2009
Why?
Ghost works well for imaging
But built-in tools have issues moving large image
files, especially across multiple subnets
BITS Solution
Single server for all images
Images reliably transferred in the background while
PCs are in use
Very short downtime to image
Free – already in Windows
Same BITS solution should apply to other imaging
packages
UCCSC 2009
Background & History
Computer Lab Management
18 computer rooms
10 separate networks
330 PCs
Maintain 12 different images
Ranging from 5–10GB
PCs locked down and profiles deleted nightly
UCCSC 2009
Background & History
Windows 95 – Windows ME
Win 9X – used PC-Rdist
Worked extremely well
Could rebuild registry in DOS before Windows
started
Easy to copy changes from one lab to the next
UCCSC 2009
Background & History
Windows XP
Win XP
Didn’t work well with PC-Rdist
Needed to use Ghost for initial install
Switched to using Ghost
Testing in the office worked well
Attempted to use one Ghost console for labs
on multiple subnets
Attempted to multicast across routers
UCCSC 2009
Background & History
Ghost network issues
Encountered difficulties with Ghost tools
working across different networks
Network connectivity & reliability across
routers
Multicast didn’t work across routers
Large images meant long downtime
UCCSC 2009
Background & History
Two Partitions
Eureka moment – Ghost uses
“virtual partitions” – why not use real
ones?
Created two partitions on hard drive
FreeDOS partition
4GB initially with FreeDOS, Ghost,
and image files
Now 40GB
WinXP partition
Rest of disk
UCCSC 2009
Background & History
Two Partitions
Used PC-Rdist to copy ghost image files from
server to FreeDOS partition
Worked ok
Very fast to ghost from one partition to the
other
Simple – put new image on server and it was
copied to all clients
Could manage images for all labs from my
office
But …
UCCSC 2009
Background & History
Two Partitions
Problems
PC-Rdist took a while to copy down image
files
Could make a PC unusable for 15 minutes in
middle of day
Copying image to entire lab was very slow
UCCSC 2009
Background & History
BITS
Background Intelligent Transfer Service
(BITS)
Used for Windows Automatic Updates
Uses “spare” bandwidth to download files in
background
Already Built into XP
Robust
No disruption to student use
Uses standard web protocols
UCCSC 2009
Background & History
BITS
Switch to BITS
Moved images to web servers
Downloaded bitsadmin.exe
Created bits.pl script
Used cron for automation
UCCSC 2009
Background & History
BITS
Worked Great!
Images transferred in background
Very reliable – copy image up to server and all
PCs restored the next morning
Fast – PC have only ~10 minutes downtime
for imaging
Easy to manage images
UCCSC 2009
Image Creation Overview
Logon as restore
Sets Freedos partition as active
Reboots and reimages itself
Install new software, configure it, etc.
Run freedos.cmd in Windows to reboot to
Freedos partition
Prepares the PC for imaging
Clears event logs, set NIC to DHCP, etc
Reboots to FreeDOS partition
Run image.bat to create new image
UCCSC 2009
Image Creation Overview continued
Run windows.bat to reboot into Windows
Run upload.cmd to copy new image to server
Move the updated image to the proper directory in the
web server
The other PCs will see new image and download it in
background with BITS
Takes a few hours to download, but PCs are still in use
PCs are turned off that night.
PC set to boot at 4:00am everyday
Boot to FreeDOS partition
Installs new image
Reboots to Windows
UCCSC 2009
The Details
Windows side
FreeDOS side
Circular – so some things won’t make sense
until the end
UCCSC 2009
The Details – Windows Side
Utilities
bitsadmin
robocopy
gdisk32
cron
ActiveState Perl
UCCSC 2009
The Details – Windows Side
bits.pl
Runs every half-hour via cron
Checks status of BITS job (lines 39-77)
If a new images has been downloaded it
copies new image files to Freedos partition
and creates flag file (lines 50 – 61)
Checks web server for updated image files
(lines 79-99)
Creates BITS jobs to download images with
bitsadmin (lines 106-135)
UCCSC 2009
The Details – Windows Side
Scripts – Windows Startup script
Sets environment variables used by other
scripts from the PC name
LAB, PC_NUMBER
Sets IP address if needed
UCCSC 2009
The Details – Windows Side
Scripts – Windows Logon script
If username is restore it sets the restore flags
and reboots PC
UCCSC 2009
The Details – Windows Side
Scripts – Windows Shutdown script
If flag file exists it uses gdisk32 to make the
Freedos partition active
Runs restore.pl to create restore.bat
Clean up before imaging
Clears some log files & event logs
Set NIC to DHCP
Robocopy to make sure Freedos partition has
correct files
UCCSC 2009
The Details – Windows Side
restore.pl
Runs in shutdown script
Creates restore.bat in the Freedos partition
Uses lab and pc_number environment variables
restore.bat is custom for each PC
PC Name
SID
UCCSC 2009
The Details – Windows Side
Scripts - freedos.cmd
echo clean > c:\temp\clean
gdisk32 1 /act /p:1 /i
c:\ucd\sd 4
UCCSC 2009
The Details – Freedos Partiton
Utilities
ghost
gdisk
ghstwalk
wait
reboot
UCCSC 2009
The Details – Freedos Partiton
Scripts - autoexec.bat
@echo off
path=c:\
del *.tmp
wait 5 Starting computer....
if errorlevel 1 goto end
echo Starting restore
c:\restore.bat
:end
UCCSC 2009
The Details – Freedos Partiton
Scripts - restore.bat
rem Setting up to restore PC #00 in 163LIB
c:\ghost -clone,mode=pload,src=\images\winxp.gho:1,dst=1:2 -sure -batch -fni -auto
c:\ghstwalk /cn=XXXX /bv=1:2 /sid=XXXXXX /ignore_domain /sure /fni
c:\gdisk 1 /act /p:2 /i
c:\reboot
UCCSC 2009
The Details – Freedos Partiton
Scripts – image.bat
@echo off
rem Make new ghost image in c:\images\winxp.gho
rem delete ghost files (.gho & .ghs) but keep readme file
echo y | del c:\images\*.gh? > nul:
ghost -clone,mode=pdump,src=1:2,dst=c:\images\winxp.gho -z2 -fni -span -auto -sure
dir c:\images
UCCSC 2009
The Details – Freedos Partiton
Scripts – windows.bat
gdisk 1 /act /p:2 /i
reboot
UCCSC 2009
The Details – Windows Side
Scripts - upload.cmd
Updates readme.txt in FreeDOS partition
Copies the updated image files to sever as
LABNAME.new
UCCSC 2009
Initial PC Setup
USB Hard Drive
FreeDOS
Uses ghost to install image with FreeDOS
partition and empty 2nd partition to HD
Creates restore.bat
Copies image files to FreeDOS partition
Reboots to FreeDOS partition and ghosts itself
UCCSC 2009
Initial PC Setup
Linux Flash Drive
Also working on bootable flash drive with
Linux
Connects to network and downloads image
files from web server
Partition table differences – so there are some
difficulties
Initially used floppies with DOS networking.
But trying to move away from them.
UCCSC 2009
What do you need?
Web server for images
2nd partition on hard drive
Determine what restore.bat should contain for
your setup
Script to create restore.bat if needed
UCCSC 2009
For More Info
UC Davis BITS Website
http://lm.ucdavis.edu/people/tim/lab/winxp/
Tim Leamy
[email protected]
Q&A
UCCSC 2009