Windows XP on Flash Drive

A. Things Needed:
  1. Windows Setup CD
  2. Bart PE Builder Download
  3. HP USB Disk Storage Format Tool Download
  4. USB Flash drive with at least 256 MB of storage capacity
  5. Windows XP Service Pack 2 (Windows XP Service Pack 2 for IT Professionals and Developers) Download
B. Flash Drive Requirement:
  1. A USB flash drive with at least 256 MB of storage is enough for the uses described in this article. Additional system tools or applications require more space. The upper bound limits for storage in this case is 2 GB - a byproduct of the tool's use of FAT16 for the local file system.
  2. Most new motherboards recognize USB flash drives as valid boot media. But conventional motherboards that are more than two years old aren't likely to boot from a USB flash drive. But in many cases, this omission can be remedied through a BIOS update for that board.
  3. 1.5 GB of unused disk space is the maximum needed for the tool to do its job, particularly if you want to pre-install Service Pack 2 and RAM disk capabilities. 190 MB of unused space is all that's needed to use PE Builder and the applications described in this article, however. Additional plug-ins will increase storage requirements, as will additional tools or software.
  4. 512 MB of USB flash drive storage space is needed only if boot-up works from a RAM disk. Otherwise, 256 MB is big enough.
  5. Access to a USB 2.0 port is not mandatory, though booting with a USB 1.1 port takes about five times longer.
  6. A Windows XP Setup CD works fine as a foundation for PE Builder to generate the USB flash drive's contents.
C. Step-by-Step Installation:

1. Formatting the Flash Drive
  • Install HP USB Disk Storage Format Tool.

  • Once installed, you can run the program through this sequence of menu choices: Start> Programs> Hewlett-Packard Company and then click "HP USB Disk Storage Format Tool"
  • Select the USB flash drive you wish to format from the Device entry.
  • Select FAT as the target file system for that device.
  • Click Start to launch this process.
  • Once completed, you must then copy the Windows XP boot files to the USB flash drive - namely:
  • x:\boot.ini
  • x:\ntldr
  • x:\ntdetect
    • Note: x = systemdrive. (if you know the drive ID where these files live, use that instead - it's normally C.
  • To make Windows Explorer display these files (they're hidden by default),
  • Choose Folder Options from the Tools menu.
  • Click the View tab in the Folder Options window.
  • Click the radio button underneath Hidden Files and folders that reads "Show hidden files and folders."
  • Uncheck the box next to "Hide protected operating systems (Recommended)," so you can select and copy these all-important Windows XP files to the flash drive.
  • Flash Drive is now bootable.
2. Set The System's Boot Device Sequence
  • Make sure that "USB Boot" was set to "Enable," as shown.
(BIOS SETUP screen 1)

Note: Your PC's BIOS settings may differ but the key settings are usually named something like what you see here and in the next two screens.
  • Under "Removable devices", Set the USB drive as the first drive, with the standard floppy drive second.
(BIOS SETUP screen 2)

Note: Not all PC's require that you specify Removable devices; but if yours offers such a setting, see if a USB device is listed within.
  • Under "Boot Device Priority", Set the USB drive as first. Save the changes and you're ready to go!
(BIOS SETUP screen 3)


Note: The Boot Order is important; you want the USB device to be first in line. Once that's set, save your changes, and reboot.
3. Adding Service Pack 2

The PE Builder program that installs Windows XP onto your USB flash drive requires an actual Windows XP CD. If you already have a Windows XP CD that integrates Service Pack 2, skip this section and jump ahead to the heading that reads "Adding Utilities".
  • Pre-installing Updates
  • Create a new folder on your hard disk (example C:\sp2\winxp).
  • Use Windows Explorer to copy the entire contents of your Windows CD into that folder.
  • Make sure that you've set Folder Options in Explorer to "Show hidden files and folders" and have unchecked the box next to "Hide protected operating system files (Recommended)" as described earlier.
  • Create a second folder named C:\sp2\sp2 for the update files as well.
  • Service Pack 2
    • Download the version called "Windows XP Service Pack 2 for IT Professionals and Developers".
    • If you want the download for a language other than English, select the language from the "Change Language" pull-down menu, then click "Download".
    • Save this file (which shows up in Internet Explorer as "Windows XP-KB835935-SP2-ENU.exe") in a file named "xpsp2.exe" into the C:\sp2 folder.
    • Open a command window using the Start, Run menu entries.
    • Type "cmd" into the Open: text box, and click the OK button.
    • Extract the contents of the service pack by typing the following instruction at the command line: C:\sp2\xpsp2.exe -u -x:c:\sp2\sp2
  • Updating the XP Setup Files
  • update all of the XP Setup files in the "C:\sp2\winxp" folder with the following command line instruction: C:\sp2\sp2\i386\update\update.exe -s:c:\sp2\winxp
4. Adding Utilities

Windows XP normally requires more than 1 GB of storage space on a hard disk. To enable the operating system to fit on a 256 MB USB flash drive, all non-essential components must be stripped away. The freeware program PE Builder handles the selection of XP components in this case. It installs something called Bart PE, a much-reduced version of Windows XP that also includes system utilities.
  • PE Builder Setup
  • If possible, install PE Builder in a folder called "C:\Program Files\pebuilderXXXX. You'll find the program listed under "Computer, USB-Stick-Windows". Accept the default installation path - namely "C:\Program files\pebuilderXXXX". The PE Builder program includes many useful system tools, which it writes to the USB flash drive along with Windows XP. These appear in the sub-folder named "C:\Program Files\plugin" - among which, for example, you'll find the file manager a43 inside a further subfolder named "\a43\files". The file named "a43.inf" contains data otherwise found in the Windows Registry. For some such subfolders in the plugin folder, you'll find the program files to be missing. These belong to third-party tools such as Ad-Aware or Nero Burning ROM that PE Builder doesn't install by default. But these subfolders do contain the necessary INF files that PE Builder can use should you decide to include these programs in what's written to the USB flash drive yourself.
  • Here's how that works:
    • Nero Burning ROM
    • First, install the DVD burning program Nero on your PC.
    • Copy all the files from the installation folder - usually this will be C:\Program Files\ahead\Nero" - into the PE Builder subfolder named "C:\Program Files\pebuilderXXXX\ plugin\nero burning rom\files".
    • Now, open the file named "penero.inf" with a text editor in the plug-in folder named "nero burning rom"
    • Look for the area where the Nero version you've downloaded is identified: "5.x" or "6.x".
    • Remote all semi-colons from the entry named "[Software.AddReg]" and delete all three num bers that follow as well.
    • Replace those values with your user name, the company name and the serial number for your copy of the software.
    • Save the file, then exit the text editor.
    • Ad-Aware SE Personal
    • Install the anti-spyware program Ad-Aware SE Personal (Freeware). Update the program. Copy the files named "defs.ref" and "ad-aware.exe" in the plug-in subfolder named "C:\Program Files\pebuilderXXXX\plugin\adawarese\files".
    • Drive-Snapshot
    • The Drive-Snapshot imaging tool belongs to the standard collection of programs that PE Builder installs. This particular version is an evaluation copy that only works for a certain limited trial period. After the trial period elapses you can still restore drive images you've already captured, but it won't let you make any new snapshots thereafter. To make the tool work without such restrictions, you need a full version of the "snapshot.exe" file. You can download this from http://www.drivesnapshot.de/ and copy it into plug in directory named "C:\Program Files\pebuilderXXXX\plugin\snapshot".
    • Firefox
    • A slimmed-down version of the Firefox Web browser (Open Source) was developed especially for PE Builder and the mini-Windows Bart PE implementation. Unpack the contents of the file named "firefox-2.2.zip" into the plug-in directory named "C:\Program Files\pebuilderXXXX\plugin" and the necessary sub-folders will be set up for you automatically.
    • McAfee Stinger
    • McAfee's Stinger virus scanner (freeware) keeps track of the most dangerous Trojans and worms and gets rid of malware. Copy the file named "s-t-i-n-g-e-r.exe" into the folder named "C:\Program Files\pebuilderXXXX\plugin\stinger".
    • Total Commander
    • The program known as Total Commander (Shareware, $34/28 €) is a Swiss army knife like utility, with built-in file management, compression, FTP and image viewing components. Install this software, then copy all files from its program folder into the folder named "C:\Program Files\pebuilderXXXX\plugin\total commander\files". If you're a registered user of Total Commander, you'll also find a file named "wincmd.key" in its folder. Copy this file into "C:\Program Files\pebuilderXXXX\plugin\total commander\files". Then, use a text editor to open the file named "totalcmd.inf" in the "...\plugin\total commander" folder, and delete the semi-colon at the start of the line that reads '\files\wincmd.key=a"[...]' (note: because the quoted value includes a double-quote mark, we used single quotes to designate this particular literal string).
5. Adapting Hardware

To make Bart PE work on your PC, there are a few additional tweaks you must make to load the network interface and a DSL (or other Internet) connection.
  • Configuring A DSL Connection
  • Configuring DSL: Enter Username and Password
  • If you want to use Bart PE to access the Internet, you must activate the freeware PPPoE plug-in and configure it for your DSL connection.
  • Create a folder named "C:\Program Files\pebuilderXXXX\plugin\pppoe_xp and extract the contents of the pppoe_xp.cab (Freeware) into that folder.
  • To establish a PPoE connection, after you boot Bart PE you must also start the Network service and the PPoE service.
  • Select "New Connect..." from the available options, accept the connection name you're granted, then provide your username and password as prompted.
6. Installing Windows

With a pre-defined collection of plug-ins copied into the "C:\Program Files\pebuilderXXXX\plugin" folder and the setup files for Windows XP in the "C:\sp2\winxp" folder, you've got everything you need to install Windows and additional utilities on the USB flash drive. Your next step is to generate the files for that drive. Here's how:
  • Generating Files
  • Launch this process by selecting "Start> Programs> PE Builder> PE Builder".
  • For the value of the Source field provide the Main window with the path to the XP Setup files at: C:\sp2\winxp.
  • Leave the Custom: field blank, and leave the default value in the Output file (BartPE) intact. That will be the name of the folder that contains the USB flash drive files, in "C:\Program Files\pebuilderXXXX\BartPE" in other words.
  • Click on the "Plugins" button at the bottom of the Main window.
  • Check the resulting "Plugins" window to make sure that all the newly-added plug-ins covered in this article show a "Yes" value in the "Enabled" column.
  • If that's not the case, highlight the name of that plug-in in the list, then click the "Enable/Disable" button to turn it on.
  • PE Builder will check your settings, to make sure all of the necessary data is available, and will change the final status accordingly.
  • At this point, you can include more plug-ins using the "Add" button, if you've downloaded more of them from the Internet.
  • Click on the "Close" button when you're finished.
  • Upon returning to the Main windows, make sure that the checkboxes next to "Create ISO image" and "Burn to CD" remain unchecked, then click the "Build" button.
  • Loading The Flash Drive
  • Start the batch file named "peinst.cmd."
    • You'll find it in the "C:\Program Files\pebuilder313\plugin\peinst" folder.
    • It copies the files you generated using PE Builder onto the USB flash drive, as well as the Windows boot files.
  • Open Windows Explorer and erase all files on the USB flash drive.
  • Type 1 at the command line, then in response to the "Enter Source Path" prompt type the location of the generated Windows files: "C:\Program Files\pebuilderXXXX\bartpe".
  • Enter 2 at the command line, and provide the drive letter for the USB flash drive (for example E:).
  • Start the installation by typing 5, then 1.
If the PC won't boot from this drive, install a RAM disk as explained under the heading "RAM Disk for boot problems" that appears later part.

7. RAM Disk for Boot Problems

When the computer won't boot from the USB flash drive, it's often because the motherboard initializes all USB ports during start-up. A RAM disk often provides an effective remedy in such cases.
  • A RAM disk works like a virtual disk drive and copies all of the files from the flash drive during boot-up, before it's fully initialized. That RAM disk also replaces the flash drive as the boot medium. To use a RAM disk you need Service Pack 1 for Windows Server 2003 (free) and the program Pe2usb.cmd (Freeware). Download Service Pack 1 (it's approximately 350 MB in size) into a folder of your choosing (for example, C:\server2003sp1". Create a subdirectory in your PE Builder folder ("C:\Program Files\pebuilder313") named srsp1 and copy the file named "C:\server2003sp1\i386\setupldr.bin" into that directory.
  • Open a Command window using the "Start, Run..." menu sequence, typing "cmd" into the Open: dialog box, then click OK. Extract the file named "ramdisk.sy_" into the same folder as follows:
  • expand -r C:\server2003sp1\i386\ramdisk.sy_ \pebuilder313\srsp1
  • Reformat your flask drive. To do this, click through the following menu sequence "Start, All Programs, HP Company," then select the "USB Disk Storage Format Tool". Select the USB flash drive from the "Device" list, select FAT at the file system, then click "Start".
  • Download the "Pe2usb" tool into the PE Builder file on your hard disk ("C:\Program Files\pebuilder313". Inside Windows Explorer, navigate to that directory, then drag the file named "Pe2usb.cmd" into a Command window and drop it there. The file with a complete path specification appears on the command line. Add the drive letter for the USB flash drive to this line, then launch the command with the Enter key: \pe2usb :
  • After that, the USB flash drive is ready for booting.

1 comment:

Charlotte said...

great post, I really like it. Thanks for posting. :)