Tuesday, September 9, 2008

Installing Windows XP from USB

Case In Point


You’ve got this Acer laptop with a
malfunctioning DVD drive. Specifically, you removed it from its bay and
now Windows XP crashes when you plug it back in. Knowledge Base article
310664 matches it to a tee.


Provided solution: update to Service Pack 1, or disable DMA in the BIOS. Current situation: running SP2 and blessed with a “user-friendly” BIOS that doesn’t allow you to disable DMA.


Your luck just ran out, but - being the geek that you are - you
don’t whine about it. Instead, you come up with this bright idea: let’s
install Linux, that’ll work some magic! And so you get Gentoo Linux installed using a home-brewn LiveUSB distribution. And much to your dismay, proper hotplugging implementation for your laptop is lacking. Curses.


So finally, you call the support line to have them collect your
laptop for repair. One problem here: you’re betting they won’t like
seeing Linux boot up and, hoping to forego additional service costs,
it’s up to you to reinstall Windows XP.


One problem here: you don’t have a working CD-ROM drive to install Windows XP off, and from experience you know that Windows XP won’t install from an external drive. Blasted!


Enter the cavalry.


Disclaimer


The procedure here is provided without any warranty or support
whatsoever. It worked for me and so it might for you. It also might
blast you and your laptop to pieces. Some of the procedures described here can wipe all of your data. Thought I’d warn you.


I don’t mean to be inventive here, either. In fact, all the
technology has been laid out for us and is readily available. All I’m
doing is wrapping it all up in writing. Shouts out to everyone who
provided the technology!


That being said, let’s get down to business.


Ground Zero: Ingredients


You’ll be needing ample space on a USB storage device like a
thumbdrive or external disk drive. 1 GB of storage will suffice.
Possibly, you could access the setup files from a network share in
which case you’ll only need a 256 MB thumbdrive, but I haven’t tried
that.


Personally, I booted off a 512 MB thumbdrive and put the Windows XP
setup files on an external disk drive. So a combination will do just
fine, but just make sure that you’ve got sufficient USB ports: all USB devices will need to be plugged in and stay plugged in while we’re booted into BartPE later on!


You’ll also need a bunch of software, including a valid copy of
Windows XP. The other software components can be downloaded freely:



Q: Why Windows 2003 Server Service Pack 1? I want to install XP!


A: Well that’s exactly the trick, though it’s a bit technical.
During booting, Windows resets the USB port and loses your boot device.
That’s why an installation from USB normally fails. But by using
Windows 2003 Server’s ramdisk feature in the early phases of booting,
we circumvent that problem.


Don’t be mislead though: you’ll be installing Windows XP all the
same. It’s just that we’ll be using two Windows 2003 Server files from
the Service Pack to do it.


You can also perform a Windows 2003 Server installation using this
exact same procedure, save that you’ll be needing to update to Windows
2003 Server Service Pack 1 instead of Windows XP SP2, below. That’s
assuming, of course, that you’ve got a valid copy of Windows 2003
Server.


You will also need an already functional Windows system to prep the
USB disk from. In addition, your target system (the one that needs
reinstalling) should support booting from USB. Virtually all modern
ones do though.


Finally, not all cheaper USB devices properly support being booted from. The BartPE forums have a partial list of ones that don’t.


Step One: Preparing the Windows XP Setup Files


For this procedure to work correctly, you’ll need Windows XP to be
at Service Pack 1 or Service Pack 2. Many newer Windows XP CDs already
have either one included.


You can check by inserting the CD-ROM and looking at the files in the top folder. There should be a file named WIN51P.SP1 or WIN51P.SP2.
If you see either one, fast forward to step two.If there is no such
file, or you’ve got a SP1 CD that you would like to update to SP2,
proceed as follows:


  1. Copy the Windows XP CD-ROM to a location on your hard drive. We’ll be assuming C:\winxpcd. I strongly advise you to use such a vanilla CD. Users have reported strange happenings with custom XP distributions.
  2. Download the Windows XP Service Pack 2 Network Installation Package.
  3. Unpack Windows XP SP2 by running WindowsXP-KB835935-SP2-ENU.exe -x. Note the -x parameter that will allow you to specify a location to unpack to. We’ll be assuming C:\winxpsp2.
  4. Integrate SP2 into the setup files by running C:\winxpsp2\i386\update\update.exe /integrate:c:\winxpcd.

If your system needs special drivers to operate, this would be the
time to include them (called “slipstreaming”). Doing so isn’t exactly
trivial and should only be necessary if you, say, require non-standard SATA support. The process is beyond the scope of this article, but fortunately Google is your friend.


Step Two: Prepping BartPE


First we’ll prep the USB drive we’ll be using for booting. This is
by far the largest step in the process, though it shouldn’t be
difficult for anyone to follow. It requires a functional Windows system.


  1. Install BartPE. We’ll be assuming that you install to C:\pebuilder.
  2. Unpack PE2USB to C:\pebuilder.
  3. Unpack Windows 2003 SP1 by running WindowsServer2003-KB889101-SP1-x86-ENU.exe -x (that’s assuming that you downloaded the English version). Note the -x parameter that will allow you to specify a location to unpack to. We’ll be assuming C:\server2003sp1.
  4. Create a folder named C:\pebuilder\srsp1.
  5. Copy C:\server2003sp1\i386\setupldr.bin to C:\pebuilder\srsp1.
  6. Expand and copy ramdisk.sys by running expand -r C:\server2003sp1\i386\ramdisk.sy_ C:\pebuilder\srsp1.
  7. Start PE Builder from the Start Menu. Point “Source:” to the location of your Windows XP setup files containing SP1 or SP2.
  8. Make sure the “Output:” is set to “BartPE”. If using SP2: go into the Plugins configuration dialog and enable “RpcSS needs to launch DComLaunch Service First - SP2 only”.
  9. Hit “Build”.
  10. When it’s done building, insert the USB drive you intend to boot from and run C:\pebuilder\pe2usb -f [drive:], replacing [drive:] with the location of your USB drive. This will destroy any data on your USB drive!
    The drive shouldn’t be partitioned any larger than 1 GB. If it is, then
    repartition it using Computer Management in the Control Panel.
  11. Copy the Windows XP setup files to the USB drive (or another USB
    device if you have insufficient space left). You’ll only need the i386 folder.

If no errors occured in the process, you should now be all set to boot from USB!


Note: it’s possible to use Windows 2003 Server as the operating
system to boot from, but I don’t recommend it. Many of BartPE’s
included utilities won’t work properly.


Step Three: Configuring the BIOS


You should now reboot and go into the BIOS configuration to boot
from USB. Instructions for doing so wildly from system to system, but
generally entail the following:


  1. Reboot the system.
  2. While booting (before Windows starts loading), get into the BIOS
    configuration screen by hitting something like F1, F2, Delete or
    Escape. Hotkey instructions are generally provided on the screen.
  3. Go to the section that contains your boot devices.
  4. With your USB drive plugged in, the USB drive should be listed. If
    it isn’t, your system might not support booting from USB. Assuming that
    it is supported (as is the case with virtually all modern hardware),
    promote your USB drive to the primary boot device.
  5. Exit from the BIOS configuration, saving all changes.

If you’re completely new to BIOS configuration, BIOS for Beginners
over at Tom’s Hardware might be a good primer. Be aware though, that
you can seriously screw up your system by providing incorrect settings!


Step Four: Booting into BartPE


Assuming that you properly configured your BIOS and your USB device
supports booting, BartPE should now load. Depending on the speed of
your USB device, this may take a while.


If it isn’t working, then double-check the following before making a scene:


  • Is your BIOS properly configured for booting from the USB disk? (Is the USB device listed and does it have top priority?)
  • Have you correctly prepared the USB disk in step two? (Restart the procedure.)
  • Does your USB stick properly support being booted from? (Try another one!)

Step Five: Prepping the Hard Disk


You need to make sure that your hard drive is partitioned and
formatted properly. Especially if you’ve had Linux or some other
operating system on it, you’ll need to repartition and format it.
BartPE contains DiskPart for disk partitioning and A43 File Manager to format your drive.


If you are sure that your hard drive is set up properly (i.e. it has
only run Windows, it contains a valid FAT or NTFS partition) then you
can safe yourself the hassle and skip this step.


This procedure will destroy any data on the hard drive.


To repartition:


  1. From the Go menu, navigate to DiskPart.
  2. Enter the commands needed to repartition your drive. For example, try the following: select disk 0 (select the first disk), clean (purges the entire drive, essentially resetting it), create partition primary (creates a single partition from the entire disk), assign (assign the partition a drive letter), exit (quits DiskPart).

This procedure will destroy any data on the hard drive.


To format:


  1. From the Go menu, navigate to the A43 File Manager.
  2. Right-click on the target drive (e.g. C:) and click Format. Should be self-explanatory.

Step Six: Launching Windows XP Setup


With your drive all ready, you can now launch the Windows XP setup
with a few custom parameters. Let’s assume that the files are available
at D:\i386.


Plugging in a device now won’t work. Remember that all USB
devices will need to be plugged in right from the start while using
BartPE.


  1. Run D:\i386\winnt32.exe /syspart:C: /tempdrive:C: /makelocalsource. Replace C: with the drive you want to install Windows to.
  2. Proceed with the installation. When asked to convert the
    installation volume to NTFS, answer No. The setup program incorrectly
    believes that your USB drive (which is formatted as FAT) needs
    conversion.

The setup program will then silently close, which might make you
think that something went wrong. Don’t worry though. Reboot your
system, remove the USB drive(s) and – if all went well – you can now
finish setting up Windows XP. Congratulations!

No comments:

instantptr.com