Jump to content











Photo

VHD Based Windows To Go

vhd windows8

  • Please log in to reply
9 replies to this topic

#1 misty

misty

    Silver Member

  • Developer
  • 703 posts
  •  
    United Kingdom

Posted 17 March 2012 - 04:54 PM

What is Windows To Go?

It's basically a portable installation of Windows 8 running from a USB device. Each time the USB device is plugged into and booted on a new system it will detect new hardware, install drivers and will then allow access to Windows as normal. Any installed programs should be accessible as normal, however this is likely to depend on licensing and activation restrictions. The presentation at the BUILD conference indicates that this feature is aimed at enterprise customers only.

I'm not sure that the methods outlined below and existing instructions (e.g. Steve6375's tutorial) will, strictly speaking, create a true Windows To Go installation. The only official release of Windows To Go that I am aware of is the prebuilt Kingston USB 3.0 sticks released at the BUILD conference - I have more chance of being struck by lightning than getting my hands on one of those. According to the BUILD conference a Windows To Go session will not allow access to existing hard disks on the Host system, however in my own tests using the methods below (and Steve6375's tutorial) all drives were mounted.

Windows 8 appears to be a much more portable version of Windows than previous releases and (as other users have noted) will autodetect new hardware, install new drivers and then (hopefully) boot without issue if a standard (e.g. non-USB, internal) hard disk is moved to a new system. I would argue that all Windows 8 installations can therefore be used as a base for Windows To Go.

I have tested the same USB installation on three different systems and have not had any major issues. First boot on a new system takes a while as new hardware is detected, however subsequent boots are relatively quick. Windows appears relatively fast considering the potential USB 2.0 bottleneck on the systems I've tested it on.

I would personally recommend using a USB hard drive as opposed to a USB stick. Large USB sticks are expensive and might not work. Some reports indicate that a USB stick must show as a fixed disk to boot Windows To Go - I simply do not have the hardware required to test this.

Why VHD? Why not? I like using a container file as it's easy to backup or move. Copying the VHD file containing the installation is an easy method of backing up an operating system and does not require third party tools. In addition there is very little performance hit compared to a traditional hard disk installation. I also like the differential image features of Native Boot VHD.


Methods

There are several ways to create a VHD based Windows To Go.

Method 1 - Create and mount a VHD file on a USB drive using diskpart, apply install.wim to it (using either DISM or ImageX) and use bcdboot to create boot files. This method is adapted from Steve6375's tutorial (number 53 - see here).

Method 2 - Use an existing VHD file with Windows 8 already installed to it, copy it to a USB drive, mount it using diskpart, use bcdboot to create boot files on the USB drive and edit the registry to modify mounteddevices key (deleting all entries for the internal drive it was copied from to avoid pagefile issues).

Method 3 - Use windows 8 setup DVD (or USB). Prior to running the installer use the Repair your computer option and start a command prompt, create and mount a VHD file on a USB drive using diskpart, continue with setup and chose the mounted VHD file as the target disk when asked Where do you want to install Windows?.

Unfortunately the boot files (bootmgr and the BCD store, etc) are created on the active primary partition on the host system when using this method. To create boot files on the USB drive - after the installation has completed, boot to the windows 8 setup DVD (or USB) again, chose the Repair your computer option and start a command prompt, mount the VHD file and then use bcdboot to create the required boot files.


Method 3 - Walkthrough

This is a brief walkthrough of Method 3 (see above). These notes might be a bit vague (and rough) in parts - sorry. Tested with 32-bit Consumer Preview only.

I wanted to use as few tools as possible and tried to restrict myself to just using a Windows 8 Consumer Preview USB installer - I believe that this method best meets these requirements.

Quick note - the test system was as follows -

* Netbook with internal hard drive.
* USB external hard drive (VHD will be created here)
* USB stick (bootable - with Windows 8 CP setup files)

The netbook drive and external USB hard disk both had exisiting primary (active) partitions - empty and formatted as NTFS. These partitions can easily be created during the setup process if required.


PART 1 - Creating VHD Installation

Attached both USB devices and booted from the USB stick to start Windows 8 CP setup.

On the first Windows Setup screen I chose the relevant language and clicked on Next

On the next screen I choose the Repair your computer option, followed by Troubleshoot > Advanced Options > Command Prompt

Started Diskpart and checked the mount points for the drives - internal drive = C:, USB stick = D:, external USB drive = E:.

Created a (sparse) 20GB VHD file using the command
create vdisk file=E:\Win2go.vhd maximum=20480 type=expandable

Selected the newly created VHD file using the command
select vdisk file=E:\Win2go.vhd

Mounted the VHD file using the command
attach vdisk

Exited diskpart using command
exit

Started setup by using the command
D:\setup.exe

Clicked on Install Now

Entered product key DNJXJ-7XBW8-2378T-X22TX-BKG7J for 32-bit version.

Accepted Eula

Selected Custom: when asked Which type of installation do you want?

Chose the mounted VHD when asked Where do you want to install Windows? (Drive 3 Unallocated Space on my system) - ignoring the warning message stating that Windows can't be installed on this drive.

Waited for files to be copied, expanded, etc and completed setup.

Note - I checked to see which drive the pagefile had been created on. As it was already on the external USB drive I did not have to worry about editing the mounteddevices key.


PART 2 - Creating Boot Files on USB Drive

Attached both USB devices and booted from the USB stick to start Windows 8 CP setup (again).

On the first Windows Setup screen I clicked on Next

On the next screen I choose the Repair your computer option, followed by Troubleshoot > Advanced Options > Command Prompt

Started Diskpart and checked the mount points for the drives - internal drive = C:, USB stick = D:, external USB drive = E:.

Selected the VHD file using the command
select vdisk file=E:\Win2go.vhd

Mounted the VHD file using the command
attach vdisk

Checked the drive letter for the newly mounted VHD file - VHD drive = F:

Exited diskpart and ran the following command to create boot files
bcdboot F:\Windows /s E:

Restarted Diskpart and selected the VHD file using the command
select vdisk file=E:\Win2go.vhd

Unmounted the VHD file using the command
detach vdisk

Booted from the USB drive to test - everything worked fine.

Hope this is useful.

Regards,

Misty
  • Nuno Brito and amalux like this

#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13441 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 March 2012 - 05:10 PM

I have more chance of being struck by lightning than getting my hands on one of those.

Are you - by any chance - a postillion by trade? :dubbio: ;)
http://en.wikipedia....ck_by_lightning

:rofl:

Nice tutorial. :thumbsup:

:cheers:
Wonko

#3 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 343 posts
  •  
    India

Posted 18 March 2012 - 03:40 AM

On the same system, if I install Windows 8 to a VHD on :

1) a internal (SATA) HDD.
2) a USB device.

what would be the difference in the two installations ?

#4 misty

misty

    Silver Member

  • Developer
  • 703 posts
  •  
    United Kingdom

Posted 18 March 2012 - 07:13 AM

@Wonko
Thanks for the feedback. Will you ever test this BTW? I've come across various posts of yours that indicate you'll stick with Windows 2000 forever :rofl:


@gbrao
The USB installation would be slower ;)

If you don't need portability then I would recommend that you install to the internal hard disk only.

However, if the instructions are followed to ensure that the USB is self contained (it has it's own boot files and and correct menu entries), then the USB drive can be used on multiple systems. Also, it can be used for backup/restore/rescue/repair purposes if your internal drive installation becomes corrupted.

See Steve6375's Windows to go - Windows 8 on a stick! thread for more details on Windows To Go - it contains some useful information and a link to the BUILD conference Windows To Go presentation.

Regards,

Misty

Edited by misty, 18 March 2012 - 07:17 AM.


#5 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 343 posts
  •  
    India

Posted 18 March 2012 - 09:28 AM

uhhh ... no, i was wondering since install to a usb device is slow if i could install to a vhd on hdd and then just copy the vhd to the usb device ( and making changes to the boot config ).

#6 misty

misty

    Silver Member

  • Developer
  • 703 posts
  •  
    United Kingdom

Posted 18 March 2012 - 09:37 AM

Yes you can - see hints in method 2 in the first post. Note however, you will probably need to edit the registry in the VHD file - otherwise the pagefile will be linked to the hard drive you copied it from. It's possible to edit the mounteddevices key to ensure the pagefile is on the USB device.

#7 misty

misty

    Silver Member

  • Developer
  • 703 posts
  •  
    United Kingdom

Posted 18 March 2012 - 05:04 PM

The following provides a few more details on Method 2 (see first post).

This method can be used to create a Windows To Go system by copying an existing VHD file from an internal hard disk to a USB hard disk

There are two issues to overcome when doing so. Firstly, boot files will need to be created. Secondly, the mounteddevices registry key may need to be edited to ensure the pagefile is on the USB drive.

The following is my preferred method for achieving these two goals - there are other methods.

I am not sure how the drive to be used for the pagefile is calculated and lack the time and resourses to test this out fully. Editing the MountedDevices key however does allow this to be controlled.

Method 2 - walkthrough

1 - Assuming you already have a working Native Boot VHD installation on an internal hard drive - boot into the VHD file you plan to copy to the USB drive, then plug in the USB hard drive. This will mount the USB drive and add an entry to the mounteddevices registry key. Make a note of the drive letter of the partition/drive you plan to use on the USB hard disk. Steps 9-11 assumes that the USB was mounted as drive E: in this step. Also check the drive letter containing the pagefile. Step 11 assumes that it's drive D:.

2 - Boot to another operating system (tested with WinPE 3.*/4 and Windows 7/8) - this will be used to copy the VHD file and to make offline edits.

3 - Copy the VHD file from the internal drive to the USB drive. The following assumes that the path to the VHD file on the USB drive is D:\Win2go.vhd

4 - Start diskpart and select the VHD file using the command
select vdisk file=D:\Win2go.vhd

5 - Mount the VHD file using the command
attach vdisk

6 - Make a note of the drive letter assigned to the mounted VHD file - e.g. E:

7 - Exit diskpart using command
exit

8 - Start a command prompt and use the following command to mount the VHD's system registry hive
reg load HKLM\_VHD_SYSTEM E:\Windows\System32\config\system

9 - Start regedit and go to the HKLM\_VHD_SYSTEM\MountedDevices key. Ensure that you keep the entries for the \DosDevices\C: (the VHD file) and \DosDevices\E: (the mount point for the USB drive from step 1) keys, and delete all other \DosDevices\ entries.

10 - Delete all \??\Volume entries except those that correspond to \DosDevices\C: and \DosDevices\E:.

11 - Rename \DosDevices\E: to \DosDevices\D:

12 - Unmount the VHD's system registry hive using the command
reg unload HKLM\_VHD_SYSTEM

13 - Create boot files on the USB disk by using the following command (E:\Windows is the mounted VHD system and D: is the USB drive where the boot files will be created) -
bcdboot.exe E:\Windows /s D:

14 - Start diskpart and use the following command to select the VHD file
select vdisk file=D:\Win2go.vhd

15 - Unmount the VHD file using the command
detach vdisk

Now boot from the USB drive to test.

Regards,

Misty
  • crashnburn likes this

#8 jan2777

jan2777
  • Members
  • 1 posts
  •  
    Netherlands

Posted 29 July 2012 - 12:06 PM

Hello

I tried the option 3 this morning with the win 8 release preview, but i cannot get the installer to continue to install on the vhd drive. The warning that the partition cannot be used seems a hard stop now. At least i found no way to continue there.
Did others found a way around this ?

#9 gearmaker

gearmaker

    Newbie

  • Members
  • 21 posts
  •  
    United States

Posted 30 July 2012 - 04:33 AM

This is pretty cool stuff !!! :smiling9: So, I had followed wimb's guide with his image xp tools and created a win 7 vhd file and placed it on a usb drive and made it bootable.
I then tried it on the two desktops I have and also on my wife's old Sony Vaio laptop using plop. It booted on all three, but on the laptop it had trouble with the keyboard.
I then saw this topic and had to try it.I used method 1. After I applied the install wim I used easybcd to add an entry to point to the vhd file and finish the install.
Well. bootmgr complained that it couldn't verify the winload.exe or something to that effect. So it refused to boot. :( So then I copied the vhd file to the usb drive
and used cmd prompt and bcdboot to create files on the usb drive. Win8 booted and finished installing :clap: . It booted fine on all machines and it had no problem
with the laptop keyboard driver.
Very nice guide misty!! Thank you

#10 crashnburn

crashnburn

    Frequent Member

  • Advanced user
  • 113 posts

Posted 12 October 2015 - 12:52 PM

 

 

 Start a command prompt and use the following command to mount the VHD's system registry hivereg load HKLM\_VHD_SYSTEM E:\Windows\System32\config\system
9 - Start regedit and go to the HKLM\_VHD_SYSTEM\MountedDevices key. Ensure that you keep the entries for the\DosDevices\C: (the VHD file) and \DosDevices\E: (the mount point for the USB drive from step 1) keys, and delete all other\DosDevices\ entries.

10 - Delete all \??\Volume entries except those that correspond to \DosDevices\C: and \DosDevices\E:.

11 - Rename \DosDevices\E: to \DosDevices\D:

12 - Unmount the VHD's system registry hive using the commandreg unload HKLM\_VHD_SYSTEM

 

Would those page file registry stuff {Steps 8 to 12} be needed if my VHD was moved from one internal drive to another?

 

Lets stay the above registry changes were done, to run it off a USB VHD, and then it was moved to an internal drive, would some changes still need to be made or it would create paging on internal drive at the time? 


Edited by crashnburn, 12 October 2015 - 12:53 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users