Sunday, March 21, 2010

WinPE Multi-boot a Bootable USB Storage device


Things like this keep up my faith in blogging and the blogging scene.

I’ve posted a number of articles related to WinPE as well as making portable storage devices (USB HDD/ USB flash sticks) bootable for use as WinPE boot media.

It was under that last, most recent post that I mentioned a trick I do to carry multiple WinPE boot.wim varieties on my bootable USB stick:

On my own bootable USB flash stick, in addition to the required “SOURCES” folder and contents, I also have a “SOURCES-ALT” folder.  In there I keep all my additional and scratch-space-adjusted WIM files.  So I have a  Boot-32.wim, Boot-128.wim, Boot-256.wim, and a Boot-512.wim file stored in there.  Typically, I have the 512 MB set scratch-space boot.wim file in my SOURCES folder to boot with.  However, if I know I need to WinPE boot a system that that wouldn’t work on, then I can delete the boot.wim file out of my SOURCES folder on the USB stick, and copy another more appropriate version from my SOURCES-ALT folder over into it, say the Boot-128.wim one.  Then I rename it to boot.wim and I am good to go!

In fact, once the contents of the WIM file are loaded into the scratch-space/RAM Disk, it is then released.  That means if you are going from a system that uses the 512 MB scratch-space, and then progress on to one that will require the 64 MB scratch-space version, it seems you can do the boot.wim delete/copy/rename routine on your USB stick still from within your WinPE boot session!  I’ve done this on a number of occasions.

Even more fun is making up not just different scratch-space flavors of the boot.wim file, but even wholly different versions of the boot.wim file itself!  You could have a custom WinPE 2.0 boot.wim file, a custom WinPE 3.0 boot.wim file, an AntiVirus PE Disk to offline-scan a Windows system, or maybe, say, a Win(FE) forensics build boot.wim, and so on…limited only by the size of your USB storage device and your imagination and efforts.  Even different WIM files with different hardware drivers injected for various system platforms.  Instead of carrying a mess of optical disks, just a single large USB storage may do the trick (assuming the system BIOS supports USB based booting).

Of course, you do have to reboot the system to then load whichever WIM file you have swapped out…but I’m sure you knew that already.  Just keep the originals safely and alternatively named in your “storage” folder location and delete/copy/rename the original boot.wim file as needed.

Brilliance = Bret ?

Well, there I was thinking just how clever a trick this was to sort-of “multi-boot” the WinPE’s off my USB stick.

Then Bret came and visited the blog and dropped an “outside-the-box” kind of comment that was bloody brilliant.

Instead of copying and renaming your boot-*.wim files, have you thought about using bcdedit to add entries to display a bootmgr menu with choices of each wim? You could keep all of the wims in your sources folder, too. I like to have a menu with a 4-second timeout to the default.

I read it and just sat there stunned.


Simple and elegant…and something I was already familiar with (in concept) from my earlier boot to VHD work.

Crap.  Now I’ve got yet another fun project to work on tweaking my super-boot USB stick.

In case you haven’t caught what Bret proposed, he is saying that we can just set the BCD file in the \boot folder to point to additional wim entries as well as the default boot.wim.  You can name then whatever.wim you wish and then when you boot from the USB device, be offered a nice multi-bootloader menu and select which particular flavored wim you want to boot from.

No swapping out/renaming of the extra wim’s you carry.  No rebooting to get the one you want loaded.


Simply brilliant.

How To Resources #1

Amazingly, I didn’t find all too many references to this trick on the Net and forums.  There are a few, and they all seem to be pretty recent.

Below are some of the best resources I located to help guide someone through the process.

Both of these techniques require comfort and skilled familiarity with the command-line bcdedit.

Just take a lot of notes and make sure you have pre-structured which wims you want to use before you get started.  Being organized first will save you a lot of headaches.

How To Resources #2

If you are just not a CLI person, then there is at least one GUI alternative to use: EasyBCD

The current version does allow you to work with PE files.

The trick is to first run the program then load the BCD (Boot Configuration Database) file on your portable WinPE boot stick located in the\boot folder.

However, I discovered that the EasyBCD 2.0 Beta Builds (free registration required to access) have even more robust and enhanced support.

With the latest version (2.0 Beta Build 86) You can actually not just add additional WIM files to your bootloader but VHD files as well. ISOs are another option but I’ve got enough on my hands for now to take in!

Using EasyBCD should allow you to back up your existing bootloader file before making changes.  Just be very sure you are on the USB drive \boot folder and not the one for your primary system.  If you get mixed up and start making incorrect changes, bad things could happen man.

Sure, with the base bcdedit application, you have all you need without extra software, but EasyBCD is very slick and just (basically) provides an advanced GUI wrapper for the bcdedit app at the core.

Choice is yours.

Here are some additional links that while not directly related to multi-booting of USB sticks, do have additional great examples of bcdedit in action for reference.

Final Thoughts

This is a really cool synthesis of concepts and even more could be extended from this on your USB device.  Really the only limits are the size of your storage device to hold the files, the memory of the system it is running on, and the speed of the hardware to make it usable.

You almost certainly don’t have to limit yourself to just WinPE wim files.

Imagine also if you had a VHD file of a full-blown specialized Windows 7 system  or Sever 2008 to pick from your bootloader list, and not just the WinPE flavors.  Awesome.

Spend some time poking around on Mark Wilson’s blog.  He’s got a lot of research and lessons learned on his and other sites he found that we can benefit from there.

  • Running Windows from a USB flash drive– Mark Wilson blog. .

  • Windows 7 and Windows Application Compatibility : Boot from Windows 7 VHD Boot without having any native Operating System.

  • Booting Hyper-V R2 off a USB stick – Virtual PC Guy’s weblog.

  • Create bootable USB drive for Hyper-V Server 2008 R2 – MSDN Code Site.

  • Boot from VHD – the joy of BCDedit and a nice hyper-v gotcha or two – James O’Neill’s blog.
  • My Boot-to-VHD experiment: found some tips, like it, but still haven’t found VM nirvana - Jon Galloway.
  • Anyway…you get the idea.

    I’m likely to stick to WinPE / WinFE wims myself but I’ve already got a project in mind once I get my own USB boot stick squared away.

    We deploy to our techs a bootable WinPE portable HDD.  It boots from the base WinPE boot.wim (32 MB RamDisk). None of the extras and we use it for imagex system image deployments.  I’ve stuck with the base boot.wim as it will work dependably on most all our desktop systems.

    The techs have been clamoring for me to switch out to the heavier customized WimPE image I provide them on a CD-ROM disk.

    I’ve declined as it just doesn’t work on some of our system-RAM limited desktops/laptops while the CLI WinPE base would.

    Now I can give them their cake and let them eat it too.

    Sweet baby jebus.

    All this because of Bret….


    --Claus V.

    1 comment:

    Unknown said...

    Hi Claus,

    I had no idea my suggestion was going to make such an impression, but I sure am glad I posted it. I primarily use bcdedit to set up a multi-boot menu for WinXP and WinPE to run from the same HD on a desktop system. Then when I read your post, I thought you could benefit from the method, provided there wasn't a complication I was overlooking. I really do like to find simple, efficient solutions whenever possible.

    Since I'm neither a writer nor a blogger, it's nice to find a helpful place to not only find information but also to share and give back. Rest assured, I'm continually looking for ways to use WinPE to its full potential.

    Again, thanks for the credit and I'm glad to have helped.

    Best regards,