Pages

Banner 468

Sunday, June 12, 2011

booting xp from usb

0 comments
 
Almost everyone who has worked with computers for any lengthof time at all has run into at least one situation in which a problem left a PCunbootable. What if you could return the machine to a bootable state just byinserting a USB flash drive though? Believe it or not, it is actually possibleto install a bootable copy of Windows XP onto a flash drive and then boot a PCoff of the flash drive. From there, you can use applications that you haveinstalled on the flash drive (anti virus, anti spyware, disk repair, etc.) to fix the PC's problem. In this article, I will show you how.

What's the catch?

As with most cool new techniques, there are a few catches.For starters, not every PC is capable of booting from a USB flash drive. Forthe most part, computers manufactured within the last two years are generallyable to boot from a flash drive. Older systems may require a BIOS update, ormight not be able to boot from a flash drive at all.
Another catch is that not every flash drive will get the jobdone. The primary factors that limit your use of a particular flash drive arecapacity and speed. Technically, speed isn't really a limiting factor, butbooting Windows will be painfully slow unless you use a flash drive thatsupports USB 2.0.
The flash drive's capacity is actually a limiting factorthough. Surprisingly though, there are size limits on both the upper and lowerend. Your flash drive can't be too large or too small. There isn't really adocumented minimal size for a flash drive. You just need something large enoughto hold Windows XP and a few applications. As you probably know, Windows XPnormally consumes over a gigabyte of disk space. Later I will show you how touse a free utility to trim the excess fat off of Windows XP and make it a wholelot smaller. Even so, I still recommend that your flash drive be at least aminimum of 256 MB in size.
As I mentioned, there is a maximum size for the USB flashdrive that you can use. Currently, USB flash drives exist in sizes of up to 4GB, and 8 GB flash drives are expected to be available by the end of the year.As nice as it would be to have 8 GB to play with, the flash drive that you usefor this project can be no larger than 2 GB. The reason for this is because youwill have to format the flash drive using the FAT-16 file system, which has a 2GB limit. Presently, you are stuck using FAT-16 because most computers will notrecognize a flash drive as being bootable if the drive is formatted withanything other than FAT-16.

Preparing your Windows installation CD

One of the requirements for creating our bootable USB flashdrive is a Windows XP with Service Pack 2 installation CD. If your Windows XPinstallation CD doesn't already include Service Pack 2, then you will have tomake a CD that includes Service Pack 2 through a technique called slipstreaming.

Other requirements

In addition to your Windows XP installation CD, there are acouple of other things that you are going to need. For starters, you will needthe HP USB Disk Storage Format Tool. You can download this tool for free.
Another utility that you are going to need is Bart'sPreinstalled Environment Bootable Live Windows CD / DVD, or BartPE for short.You can download this utility for free from the BartPE Web site.
In addition to the software requirements, you must verifythat the PC that you will be using to create the Windows deployment has 1.5 GBof free hard disk space (minimum) and supports booting from a USB device. Ialso strongly recommend that the PC be running Windows XP Service Pack 2. Priorto Service Pack 2, Windows XP sometimes had trouble interacting with USBstorage devices.

Formatting the flash drive

Now that you have all of the prerequisites taken care of, it'stime to actually start setting up our flash drive. The first step in doing so,as strange as it sounds, is to format the flash drive. Windows will actuallylet you format a flash drive in the same way that you format a floppy disk.However, formatting a flash drive in this way will not work for this project.Furthermore, using Windows to format a flash drive directly has been known todestroy some types of flash drives.
Instead, you must format the flash drive by using the HP USBDisk Storage Format Tool that you downloaded earlier. To do so, simply open theutility, select the device followed by the FAT file system option and clickStart.
Once the device has been formatted, you must make itbootable. To do so, you must copy the BOOT.INI, NTLDR, and NTDETECT from theroot directory of your PC's boot drive to the flash drive. These files arehidden by default, so you will either have to configure Windows Explorer toshow hidden files (including protected operating system files) or you will haveto open a Command Prompt window and use the COPY command to copy the files.
If you choose to use the Windows Explorer method, then openInternet Explorer and enter C: into the address bar so that you are looking atyour local hard drive. Next, select the Folder Options command from the Toolsmenu. When the Folder Options properties sheet opens, select the View tab. Now,just select the Show Hidden Files and Folders and deselect the Hide Extensionsfor Known File Types and the Hide Protected Operating System Files check boxes.Click OK to continue.

Booting from the USB flash drive

Now that you have formatted your USB flash drive and installedthe boot files onto it, the next thing that you must do is to configure your PCto allow you to boot from the flash drive. This is all done through thecomputer's BIOS Setup. I can't give you specific instructions for this part,because every computer is different. I can give you a few pointers though.
You can access your computer's BIOS by pressing a specifickey immediately after you turn the PC on. The key varies, but it is usuallyeither [F1], [F2], or [Delete]. Once you are in the BIOS Setup, you shouldverify that all of your computer's USB options are enabled. This might includethings like support for legacy USB devices or support for USB 2.0. If there isa time out setting for USB devices, you should set it to the max to insure thatthe system doesn't time out while waiting on the USB device to boot.
Next, find the section on boot device priority. Normally, aUSB flash drive (which is usually listed as USB-HDD, but may be listed as aremovable device) will have a very low boot priority. If the USB flash drive'sboot priority is lower than the hard disk (listed as HDD) then the only timethe computer would ever boot off of the USB flash drive is if the system wereto fail to boot from the hard disk. You must therefore rearrange the bootdevice priority so that the flash drive has a higher priority than the harddrive.

Configuring Windows

Now that we have finally made it through all of the prepwork, it's time to start setting up Windows. As you have probably alreadyguessed, the process of installing Windows to a flash drive is quite a bitdifferent from your normal, run of the mill installation. There are a couple ofreasons for this.
For starters, a full blown Windows XP deployment takes upover a Gigabyte of hard disk space. When you are installing to a flash drive,disk space is a scarce commodity. Even if you have over a Gigabyte of space onyour flash drive, you probably don't want to use it all on Windows. It would benice to have room to install a few applications. Therefore, you need to trimthe excess fat off of Windows.
The other reason why the installation process is sodifferent from the usual Windows installation is because Windows Setup is notdesigned to install Windows to a flash drive. You therefore have to configureWindows using an alternate method.
The PEBuilder utility that you downloaded earlier can takecare of both of these issues. PEBuilder is designed to create a build ofWindows XP (or Windows Server 2003) that does not take up as much space as afull blown installation. Once you create this new build, you can copy it to theflash drive. For right now, I will show you how to create a basic Windows buildand copy it to the memory stick. Unfortunately, it's rather difficult toinstall applications once Windows is up and running. Therefore, after I showyou how to create a basic Windows build, I will show you how to create a buildthat includes some applications.
Begin the process by opening PEBuilder. When you openPEBuilder, you will see a screen similar to the one that's shown in Figure A.Simply enter the path to the Windows installation files (the ones from yourWindows XP with Service Pack 2 installation CD). Next, verify that the CreateISO Image and the Burn to CD check boxes are not selected and then click the Buildbutton. PEBuilder will now create the new Windows build.
Figure A
 
















You must use PEBuilder to create a Windows build that will work with aflash drive.
Now, it's time to copy Windows to the flash drive. To do so,you will have to use a special batch file that's included with PEBuilder. Opena Command Prompt window and navigate to c:\pebuilder313\plugin\peinst. Now,insert an empty flash drive into the computer's USB port and then execute thefile PEINST.CMD. You will now see a menu appear as shown in Figure B.
Figure B











 PEBuilder uses a batch file to install Windows onto a flash drive.
Type 1 and press [Enter] and you will be prompted to enterthe path to the build that you have created. Enter C:\pebuilder313\BartPE. Now,type 2, press [Enter], and you will be prompted for the target path. Enter thedrive letter that Windows has assigned to your USB flash drive. After doing so,the menu is updated as shown in Figure C. The menu now displays the source pathand the destination drive. Type 5 and press [Enter] to install Windows to theflash drive.
Figure C











Use menu option 5 to install Windows to the flash drive.

Installing applications

Now that I have shown you how to create and install a basicWindows build, I want to talk for a moment about how you can add an applicationto the build (prior to creating it). ThePEBuilder program comes pre-configured to support a number of common Windowsapplications, but does not come with the applications themselves.
The reason why installing applications can be a little bittricky is because most Windows applications modify the Windows registry. Thebuild that you are creating is basically a collection of installation files,and the build itself does not contain a registry (the registry gets createdwhen Windows is installed onto the flash drive). As such, PEBuilder uses a sortof registry emulator.
If you go to the C:\PEBUILDER313\PLUGIN folder, you will seesub folders for a number of different applications. If you open one of theseapplication folders, you will see that the folder contains an INF file and aFILES folder. The INF file contains all of the information that would normallygo into the registry, and the FILES folder stores all of the program's files.
To see how this works, let's install an application that I'msure most of you are familiar with; Nero. Begin by installing Nero onto themachine that's running PEBuilder, as if you planned to run Nero locally on thatmachine. When the installation completes, copy all of the files from C:\ProgramFiles\ahead\Nero to C:\pebuilder313\plugin\nero burning rom\files. In thisparticular case, the nero burning rom folder is the folder that has been setaside for the Nero application. The Files sub folder is intended to store Nero'ssystem files.
Now, you must take care of Nero's registry entries. To doso, go to the C:\pebuilder313\plugin\nero burning romfolder and open the PENERO.INF file using Notepad. As I explained earlier, theINF file in an application's folder is used to store the application's registryentries. For Nero and all of the other applications that PEBuilder predefines,the INF file is pre-configured. You just have to make a few changes that arespecific to your system.
In this particular case, the PENERO.INF file is designed tosupport both Nero versions 5.x and 6.x. Initially, the lines for both versionsare commented out. You must therefore determine which version you have and thenremove the semi colon from the beginning of the lines that apply to thatversion. If you look at Figure D, you can see how the two versions areseparated.
Figure D
















An application's registry entries are stored in an INF file.
Once you uncomment the appropriate lines, just replace "YourName", "Your Company Name" and "Your Serial Number"with your name, your company's name, and your Nero product key. Save the file,and your set to go. The next time that you click the Build button, Nero will beincluded in the build.

Putting XP in your pocket

Running Windows from a flash drive isn't an exact science.Sometimes the process just doesn't work and there is no good reason why. Asmore PCs start to support booting from USB devices though, USB boots shouldbecome more standardized, and the technique should become more reliable.

Leave a Reply