Sunday, November 01, 2009

Sexy USB Boots (Win PE style)

Due to a generous birthday-fun contribution from my little bro I recently picked up a Patriot Xporter XT Boost 16GB flash drive stick for my personal use. I’ve got a number of 512 MB ones scattered around, as well as my dependable 2 GB one, but after the latest round of family IT support service calls, I really wanted one with enough room that I could store all my portable utilities on; and still have enough room for a few ISO files. More importantly I wanted a fairly-fast USB stick I could configure to use as a Win PE boot device.

Not that I have anything against bootable CD/DVD media. It certainly has its place, but having a Win PE boot stick is just so much more sexy. Not only is it wicked-fast for off-line booting a Windows system for response and support, but it also allows me to save log data or recovered files directly to, rather than try to offload them to a network share, the Net, or a non-booting USB storage device.

I’ve already covered this ground before at work with my current “for work purposes only” 8 GB USB stick. For that I used PurvianceCS’s post on how to Create a Bootable VistaPE USB Hard Drive or Flashdrive. Because this was based on my earlier VistaPE building work, it was a natural progression and worked flawlessly. It does use GRUB as the bootloader for the Win PE WIM handoff. That’s no problem and GRUB has an amazing amount of flexibility for multi-booting USB devices. However, to be honest, I never use any of the additional boot options it provides. I just boot to the Win PE WIM file and continue on.

I had in the past posted a few link round-ups to various ways and tools and techniques for making USB devices bootable.

They all are good and provide lots of great background but I really wanted a solution that was dead-fast, simple, and rock-solid for setting up a (supported) USB storage device to be used as a boot device for Win PE builds.

This was particularly important for me as well since in our IT shop we now have over twenty-five portable Western Digital external hard drives that I keep updated with ImageX-based WIM images of our various hardware systems. When I hand them out on projects, a folder goes with them containing CD-ROM’s of my custom Win PE boot disk along with a Clonezilla disk as well (images for those are on the drives as well). Wouldn’t it be nice if the CD drive was funky or problematic to allow the techs to boot directly from the same device the images were stored on? Yep.

So after some brief work and experimentation, I found the following technique worked “bestest and fastest” for not only making my personal USB device quickly bootable, but all these external USB hard drives as well. And all done with my own hands!

You already know that to use the thing, you may have to set your BIOS to the “boot from USB” option (or select it in a one-time boot option at BIOS startup…).

I actually found this easiest to do while running under a Win PE 2.0 (Vista) or Win PE 3.0 (Win7) session, though you can do it from an administrator-elevated command prompt session under Vista or Windows 7 as well.

Note: Please read this carefully, review the provided supporting cross-linked posts, and make sure you understand what you are doing in advance. Also be sure you have all the required ingredients ready and on the counter-top before you start cooking! If you don’t or aren’t sure what you are doing, you run the risk of nuking your system, possibly un-recoverably! Your Poodles might turn pink and your beloved family hamsters might escape in the night.

Format the Drive

Pop in your USB storage device.

Open a command session (CMD.exe). If not using a Win PE session, go to “Start” –> “Programs” –> “Accessories” –> “Command Prompt” and right-click and select “Run as administrator”

Type DISKPART

Let’s make sure you correctly identify which drive number your USB device is listed as!

Type LIST DISK

All storage devices will be listed. You should be able to tell which yours is by the size. In most cases, mine shows up as “1” with my local hard-drive listed as “0”. Yours may vary so check carefully and use your drive number accordingly in the next steps!

Let’s clean up the drive first to avoid any issues. Note: data loss will occur on the device at this point!

Type SELECT DISK 1 (this makes the USB drive the focus of the actions to follow)

Type CLEAN (This deletes the MBR section of the storage device)

Type CREATE PARTITION PRIMARY (This creates a fresh, single partition out of the available space)

Type ACTIVE (This makes firmware see the partition as a “system” partition)

Type ASSIGN (This assigns the next available drive letter to the device)

Type LIST VOLUME (Take a look and make note of what drive letter got assigned to the USB device)

Type EXIT

Now type the following to actually format the USB device. Make sure your drive letter is correct!

This formats the drive letter listed, with the NTFS file system, quick, without requiring confirmation checks.

And yes…I know you can also do a format from within DISKPART. I just like doing it this way. It’s a personal preference thing….

Pull on your USB Boots

Now we need to do some mojo-jojo to make the USB storage device bootable. To do so we need the BOOTSECT.EXE utility. It is on Vista and Windows 7 setup disks as well as within the Windows AIK kits for both.

I suppose you can find it available with Google as well, but I like to have the real thing from source.

The simplest way I can recommend getting BOOTSECT.EXE is to download and install one of the following WAIK’s from Microsoft. In fact, if you are bothering to read this post, and are a WinPE builder, I’d be surprised if you didn’t already have one of these installed.

Using your favorite Windows file manager program (with options enabled to see system/hidden files) pop your Win PE 2.0 or 3.0 boot disk into your system and then copy the following files/folders over to the root of your USB device:

BOOT (folder & contents)

EFI (folder & contents)

SOURCES (folder & contents)

bootmgr (file)

At this point, you can also copy over any additional folders, (portable) programs, etc. that you might want to have available from the USB device when you boot into the Win PE environment.

You should now be able to just pop the device into a system that supports USB device booting, and selecting that option (if not already configured in the BIOS) boot the system to test.

Has worked like a charm on my devices and systems using this technique. Sexy USB drive booting goodness, much faster and more convenient for system support than optical media based Win PE boot build can provide!

More Stuff

It seems like a lot of stuff to do to make your USB device bootable, but believe me. After making your tenth or eleventh USB storage device Win PE boot supported, you can do it in your sleep. For me it now takes less than three or four minutes per device now to run down the steps. Seriously!

One of the cool things I have found is that by setting up your USB storage device this way, just about any WIM PE based boot.wim file will be supported.

So what I did was create another folder SOURCES-EXTRAS and dumped other boot.wim file builds in it renamed with a descriptive hint. Then when I want to boot using a particular Win PE build, I just have to first rename my primary WIM file in the SOURCES folder to something like boot.wim.x and then copy the alternative WIM out of by backup SOURCES-EXTRA folder into SOURCES folder, then rename it to boot.wim. This gives me greater flexiblity when I need a particular Win PE build. Like not using my primary one with the sexy Laura Croft background wallpaper when I am at the in-laws…just for example….but the one with a more appropriate wallpaper for that particular audience.

Plain-jane default WinPE 2.0 and WinPE 3.0 builds directly from the WAIKs without any modifications at all. I use these only for imaging systems that have less than 512 MB system RAM.

In all these cases, generally I just need to copy the boot.wim file out of the SOURCES folder and (after renaming it) drop it into the SOURCES-EXTRA folder. Sometimes these do carry extra folders on the root, so take a look around and make sure you get any supporting folders you might need for them to work properly. Generally those will go under the USB device root.

I also make sure I have a copy of Imagex.exe taken from the WAIK was well. Note that the Win PE 3.0 IMAGEX version is more advanced (link to nice posts from 4sysops blog) than the Win PE 2.0 version. While I like the added features in the PE 3.0 one, I still prefer using the PE 2.0 for image capture/application at work and home (for now).

Odds-n-Ends

Here are some more (mostly) related posts that might be of interest to you as you expand your USB WinPE booting device.

Credits

Why this? It is the simple blog of a Last Exile fan and is intended to express the enjoyment we derive from studio Gonzo's production. Although we closely relate with those characters, we aren't them in real life. We just want to keep the memory of these incredible young kids alive. So go buy Gonzo's Last Exile DVD's!