Steven Westwell’s blog

My outlook on a few things of interest to me, and hopefully you.

Creating a bootable USB drive

Posted by Steven Westwell on July 18, 2008

I’m a little overdue on a couple of entries, but they will be coming shortly 🙂

Awhile back now, after burning far too many build cd’s and dvd’s, problems with coasters and so on, we moved to placing the build image onto a bootable 8gb USB drive.  This meant we could make small script changes on the fly and rebuild a new machine without having to update distribution points and reburn media.  In order to do this we used diskpart to format the hspeed USB sticks.

Now, on many occasion I’ve needed to reformat the USB key and completely forgotten the sequence of commands, so I am going to place them here and if anyone else happens to find it useful… fantastic! I can say that our experience has shown it can significantly speed up a build when you do not have to wait for the machine to copy a large image from an optical drive.

The one downside of using USB boot media for your builds is the fact that they can potentially be altered in an uncontrolled fashion, therefore I would suggest you either keep it within your development and build team, or potentially utilise an MD5 hash, and verify it against a value in a database at the beginning of the build process.  I did begin to write this script, but unfortunately it isnt in a state to share the code, there are a few command line applications available to incorporate into a simple script if you want to pursue this.  If I get the chance to revisit it sometime, I will also post the final code here.

ok, so how do I make my USB drive bootable?

open a command line window on your Vista machine then type the following sequence of commands:

  • Diskpart
  • list disk (you should be able to spot your USB stick by the size, take note of the number listed against it)
  • select disk n (where n is the number from the previous step)
  • clean
  • create partition primary
  • select partition 1
  • active
  • format fs=ntfs quick
  • exit

And you are done!

Copy over the contents of your build DVD and the next time you boot from this USB stick winPE should appear and do its thing.

I’ve been attempting to carry this concept over to linux live cd’s / live usb distro’s, but this hasnt been going to plan… if I get that working, I’ll update, I have a feeling that may be due to the high capacity USB drives.


2 Responses to “Creating a bootable USB drive”

  1. davidwhitney said

    Do you use network boot servers at all?

    Something like hooking up the source control checkout location of your build image to a copy of something like

    That way you could make a change, check it in, then just load up a virtual or physical machine to network boot and it’d automagically get the new boot image.

  2. Steven Westwell said

    Yes, you can use WDS instead as a PXE server to boot your machines from. With our current client we have restrictions in place to using PXE on their production network, so instead boot from a partition on the hard drive or a DVD which points back to the SMS infrastructure.

    The boot disk itself doesn’t really contain an awful lot, and the SMS distribution point can be updated to ensure builds are always up to date.

    There are options to put more of the source onto the boot disk, and if this is the case then using USB can speed up the deployment significantly, however just booting into WinPE can be very handy for diagnostics / repair options.

    When it comes to Client development, there isn’t really a source safe as such, however BDD allows you to make several configuration changes and then update your various deployment points to take the new configurations into account.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: