Deploying a XPe Image directly into a VHD
Virtual PC provides an amazing way to test XPe runtimes. We use it quite often to debug , test and demonstrate. However, deploying a runtime into a VHD is not that straight forward; you need either an Operating System in another partition of the VM or to boot to WinPE and copy it over the network. Wouldn’t it be cool, if we a can treat the VHD file as a drive or folder and copy the XPe builds directly to it. VHDMount, a tool available with Microsoft Virtual Server R2 can help us with just that. There is a short time hit to set it up initially , but deploying runtimes becomes a breeze later.
1. Download Virtual Server 2005 R2 SP1. (It is a free download!). You will not need the full installation just the VHDMount utility.
a. Launch the Setup and Click on Install Microsoft Virtual Server
b. Accept EULA and press next
c. Click on the Custom Install option
d. Disable every feature except VHD Mount. This requires about 5Mb of disk space.
e. Complete the Installation
VHDMount should be installed in %ProgramFiles%\Microsoft Virtual Server\VHDMount
2. If you have an existing VHD which has already been formatted just mount it as described in Step 3 and skip to Step 7, else create a new VHD file using the Virtual Hard Disk wizard in Virtual PC. For this exercise, let us assume the VHD file path is C:\VHDs\XPe.vhd
3. Mount the VHD using the VHDMount. Open up a command prompt and navigate to %ProgramFiles%\Microsoft Virtual Server\VHDMount.
Note: You need to open Admin Console in Vista
Type the following to mount the VHD
> vhdmount /m /f C:\VHDs\XPe.vhd
4. If you created a new VHD file you might not see the Drive yet, as the disk has not been initialized. You could use Windows Disk Manager to do this, but as geeks let us stick to the command prompt.
5. Type diskpart on the prompt
C:\> DISKPART
Microsoft DiskPart version 6.0.6001
Copyright (C) 1999-2007 Microsoft Corporation.
On computer: WORK
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 233 GB 0 B
Disk 1 Online 300 MB 297 MB
DISKPART> select disk 1
Disk 1 is now the selected disk.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> assign
DiskPart successfully assigned the drive letter or mount point.
DISKPART>active
DiskPart marked the current partition as active
DISKPART> format fs=ntfs label="XPe"
100 percent completed
DiskPart successfully formatted the volume.
DISKPART> exit
Leaving DiskPart...
6. Now you will see the VHD loaded as a drive in you computer. Just copy the XPe build bits to this drive.
7. To Un-mount the drive, type
> vhdmount /u C:\VHDs\XPe.vhd
After un-mounting the VHD, just add it to a Virtual Machine(if not already), start it and you should see FBA launching. From the next time you just need to mount it, copy the build and unmount it. Happy Debugging!
For additional kicks, you can add a shell plugin to mount a VHD file using VHDMount by double clicking on it. Check this post from the Virtual PC Guy.
Note: The method I described above only works on Vista and Server 2003. XP has some issue around un-mounting VHD files. I will try to find a solution/work around for this issue and post the result soon.
- Shiv
Technorati Tags: XPe
* Updated 5/19/08 (Added DISKPART>active)
Comments
Anonymous
May 15, 2008
PingBack from http://microsoft.wawblog.info/?p=26479Anonymous
May 15, 2008
The Virtual Server team has just released an update for Virtual Server 2005 R2 SP1. (Link) This updateAnonymous
May 19, 2008
You forgot to add "active" on the diskpart partitioning...Anonymous
May 19, 2008
curriegrad2004, Thanks for the noticing my oversight. I'll add that step to the post.Anonymous
June 02, 2008
This worked well on my Vista X64 system using virtual server 2005 SP1 EE, until Vista SP1. No VHDMOUNT no longer successfully mounts vhd volumes. i get success messages without any volumes appearing in drive manager or diskpart.Anonymous
June 09, 2008
In XP i use /c to commit the changes... vhdmount /u /c C:VHDsXPe.vhd