Steven Westwell’s blog

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

Archive for July, 2008

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.


Posted in vista | Tagged: , , , , | 2 Comments »