YAB (yet another blog) Site

Posts tagged ‘diskpart’

Windows 8 on the go

For weeks now, I’m running my Windows 8 using the open source Oracle Virtual Box. Initial Wow factor, enthusiasm to play with Metro style apps kept the ball rolling very fast. The Host and the Guest spared 2GB RAM each. All is well, until I started working with VS 11 Developer preview in the guest OS. The wait time between clicks kept on increasing. Obvious that 2GB of RAM is no more sufficient enough for dev box. I could not afford a new separate PC for Windows 8. Forget about that in the corporate environment, it’s way not possible through red tapes and governance model they have. Then, one day on a coffee talk, someone was explaining about the Linux on the go option. Wherein, User can carry their entire OS in a USB Thumb drive. After few initial failed google’ing, I came across the Build presentation by Steve Silverberg, which mentioned about Windows 8 on the GO…. To be frank, my initial thought was, it is going to be as easy as To-go order at McD. Later, I realized, it is going to cost me some round trips.

That’s interesting. I decided to try the Windows 8 on the go. Before we get carried away, let us understand, what’s this Windows 8 on the go?, By Windows-on-the-go means, installing Windows operating system on a removable/distributable disk like a USB pen drive or USB Hard Disk. When Windows 8 is installed on the USB drive, plug the USB drive into a particular computer (it can be multiple computers) and alter the boot sequence to boot from USB, for the first time, it installs required drivers for the devices around in that computer and reboots, from next time on, it boots straight into Windows 8 on the USB distributable. This is not something unique to Windows 8. Linux OS flavors have been doing this for years now. And infact, Enterprise edition of Windows 7 too have tools to make windows distributed on the go. Microsoft has been optimizing Windows 8 to run from flash, and to use flash storage, over a USB bus. Also, I read that this is not perfect, yet but better. 

Some pre-requisite for this to work on host computer,

The computer is to have either USB 2.0 or USB 3.0 and BIOS to support boot from USB and UEFI. And on the deployment side, I’m supposed to have a USB pen drive which is 32GB minimum. Portable Workspace Creator (pwcreator.exe) rejects anything below 32GB! Why is this restriction? When my Windows 8 on VDI can run on anything as low as 15GB of space! I could not find any answers. The smallest foot print virtual drive I tried for a Windows 8 32 Bit OS was 15 GB, in size. So, I wanted to still try this On-the-go stuff with a 16GB USB drive (Crazy, am I !?).

As a preparative step, with all the enthusiasm, I ordered a 16 GB HP Pen drive from FlipKart for Rs840. Flipkart took three days to deliver (a nice safe 7″ packing for a  1″ long pen drive). Now that I’ve a USB drive, I wanted to use PWCreater.Exe to load the image of Windows 8 into the portable drive.

The first bad news: I searched the entire Windows 8 systems folder for the Portable workspace creator. There’s no file called PWcreator.exe in the entire machine. Where did it go, what happened to all those Web sites which talked abt ‘The Portable Workspace creator’. Alas, this is available only for Enterprise Edition and not available part of the preview version! Bugged! MS restricted it for Volume licensing Enterprise customers only.

Back to Google, I came by one write-up by Günter Born. The time I started looking for this option only a handful of initial writers wrote about this approach. By the time, I get this completed; I could see a lot of blog posting on the same topic. Thanks to Born for this write-up. Otherwise, I would have stopped and waited for inclusion of PWCreator. Born also tried the same steps and options, I had thought but finally cracked a way out! The idea is, make use of DiskPart (Disk Partition tool) to create a clean primary partition and use an Imaging tool to copy the windows image into the USB drive and as a final step move necessary files into BOOT sector so that when UEFI/USB boot enabled computer can boot from the OS in the removable drive. Ta da!

Windows 7 rather Vista onwards provided an Automated Installation Kit. Part of this free downloadable, we get a command line tool called IMAGEX.exe, to create and deploy Windows Disk Images in the Windows Imaging Format (WIM). You can locate the WIM file under <Drive:>\Source\install.wim. WIM is a file based image format. Of late, windows setup themselves uses WAIK APIs to install the fresh instance or cloned instance of the OS. One deterrent was the download for AIK for windows 7 itself. It is hosted in one of the slowest download servers! It took very long time to download, that too, multiple times, for a single a 1.66 GB file! FlashGet is of good use, here.

Once WAIK got downloaded, I installed the AIK toolkit in the host machine. Then build an ISO of entire Tools\X86 of the toolkit and hosted it in the Guest OS, so that I could make use of these tools inside Windows 8. By the way, the Guest Virtual box setup was of the spec: A 32-bit Windows 8 8150 build. It used 2 GB of Ram from host with a 15GB VDI. Before using imaging tool, we need to prepare the USB drive for required partition. I used DIskPart tool with the sequence of commands:


REM: In my case, the HP w165 was in #1.

REM: To clean drive

REM: Creates a partition and makes it a primary

DISKPART> FORMAT fs=ntfs quick
REM: Format the partition in NTFS format

REM: Mark the selected partition as active


This prepares the partition part of the requirement for USB drive. Next comes the part to restore image using IMAGEX.exe. Open the command prompt with Adminstrator privilege and run:

> imagex.exe /apply d:\sources\install.wim 1 f:\
Here, my Windows 8 ISO was available in D drive and HP-w165 USB is in F drive.

For some of them, Imagex took 3 hours to copy. It took me close to 127 mins to complete. Next step, is to copy windows boot files into boot sector. For this, used the command,

bcdboot.exe f:\windows /s f:

For some reason, ALL option (as mentioned in born’s site was not working for me). F: represents the target media USB drive.

BCDBoot worked and successfully loaded the boot files to target USB drive. Quickly, I restarted my machine and altered the boot sequence to accommodate USB boot. I was too eager to see the windows running on the stick.

More eager you are, result sounds more critical (esp., when it is bad): The initial run on my laptop took nearly 2 hours. That too just for initial setup (Good part in that, I had the patience to wait through the 2 hours setup! ). After all slow boot up and ‘Getting Device information’ and setup cycles, Windows 8 was finally getting loaded from my USB pen drive. Any operations other than Disk read/write works like charm. But poor 16 GB kid of hard disk could not keep up to the speed. Probably, a USB 3.0 on my machine could have made is a better experience.

After some playing with Win8, I shut down the machine and took the USB out. Could feel the heat on the USB connector pin! Thank god, it didn’t melt! 😀

Anyways, Windows 8 on the Go, worked. Did it solve my problem of programming faster? No, I need to go back to a richer virtual box or set up a new separate box.

“Good judgment comes from bad experience. Experience comes from bad judgment.”

%d bloggers like this: