Step by step guide install Windows 10 using boot to VHD feature

Windows 10 is coming this year, as technology enthusiast I always interested to tryout and explore features set and developer opportunities. In this blog post I will explain how to install and explore windows 10 safely on your computer without using virtual machine software or creating new partition in your hard drive.

Boot to VHD

Boot to VHD is feature in Windows 7 (higher) system , that allows to boot windows operating system from the VHD file ( virtual hard disk file ). Basically Windows 7 systems boot loader understands , how to boot from VHD file. I wrote blog post how to do it for Windows 7 (here). In this blog post I will show how to do it on Windows 8 .

First thing download windows 10 iso file from Microsoft site. You can download the iso file by be joining Microsoft Windows insider program.

Create VHD/VHDX file from the ISO.

  • Download the Convert-WindowsImage.ps1 PowerShell script from TechNet site that allows you to create VHD/VHDX file from ISO.Launch PowerShell command  prompt as administrator, execute command to enable execution of unsigned scripts ,

Set-ExecutionPolicy Bypass -Scope Process

  • Run downloaded script in interactive mode by executing .\Convert-WindowsImage.ps1 –ShowUI command . At the end of the execution it scripts creates vhdx file  in the working directory.

image

  • Mount the virtual hard disk image from working directory.

image

  • Once image is mounted  you should be able to see new drive in your explorer. In my case it is attached ‘G’ drive.

image

 

Update boot record.

  • Now run following command create new bootable entry. Replace G:\Windows with your location where vhdx image is mounted

bcdboot G:\windows

image

  • Verify that boot order is updated properly by running msconfig.exe. You should see new entry.

image

  • Restart computer , you should new boot option.

Uninstall Windows 10 (Removing boot entry).

If you want to remove boot entry you can follow the steps

  • Launch msconfig.exe from the admin command prompt  and select entry you want to delete and press delete, reboot.

image

 

 

Advertisements

Create Bootable VHD from the Windows 7/Windows 8/Windows 2012 ISO

In my previous blog post I explained how to use windows 7 Boot to VHD feature to dual boot computer without installing OS in different partition.

To use this feature you need to have VHD file with OS installed. This blog post points to resource that allows you to create bootable VHD from Windows 7/Server 2008 R2 and Windows 8/Server 2012 setup media.

Technology used to create VHD is already built into Windows 7 and higher, in the form of Virtual Hard Disk & Windows Imaging Interface API, these API are exported from virtdisk.dll and Wimgapi.dll.

Following blog post explains how to use these built-in API in PowerShell script

http://www.pitorque.de/MisterGoodcat/post/Installing-Windows-8-Developer-Preview-as-bootable-VHD.aspx

Note: PowerShell script referred in the blog post is no longer available , use the alternative link here

Resources

  1. Virtual Hard disk API reference.
  2. Windows Imaging API reference.
  3. Windows 8 Enterprise 90-day evaluation.
  4. New Windows 8 specific  PowerShell script for creating bootable VHD.

Simple way to try new Windows OS using Boot to VHD

Try out new windows 8 release preview  or  windows server 2012 operating systems without install using Boot to VHD.

Boot to VHD is feature in Windows 7 (higher) system , that allows to boot windows operating system from the VHD file ( virtual hard disk file ). Basically Windows 7 systems boot loader understands , how to boot from VHD file.

Typical way of using boot to VHD feature involves , using command line tools such as diskpart and bcdedit which is cumbersome. Recently I was watching videos from TechEd North America 2012 , in one of the session presenter showed simple way to do the same.

Advantage of using boot VHD  over running in virtual machine ( Virtual Box or VMWare workstation) is  , OS present in VHD will get full access to actual physical hardware instead of virtualized hardware. This will allow OS perform better compared to virtual machine.

Here are the steps,

1. Download Windows Server 2012 VHD file from Microsoft site.   If you want Windows 8 release preview  , you need to create one. I will explain how in the next blog post.

2. Once you have VHD file , use run disk management tool “diskmgmt.msc”.

3. Select “Attach VHD” option from the “Action” Menu.

image

4. “Select/Enter” path to VHD location

image

5. Windows will mount the VHD and assigns drive letter. Note down the drive lettter. In my case it is mount as “G” drive. Now from the explorer you can see the “G” drive.

image

6. Launch command prompt in “Administrator” mode. Type following command to make entry in the windows boot loader

c:\Windows\system32\bcdboot G:\Windows

Note: Replace “G” with the drive letter depending on you system where VHD is mounted.

image

7. Launch “msconfig.exe” from the “Administrator” command prompt to verify that new boot entry is added in the boot loader.

image

You can change the boot order from here.

Note: Replace “G” with the drive letter depending on you system where VHD is mounted

8. If you reboot the system, now you will have option to boot into new OS.

9. Using same steps you can try out new Windows 8 client OS , if you have VHD file.

Resources

1. Windows 2012 RC VHD file

2. Creating Windows 8 Release preview VHD from ISO.

3. Watch “The Busy Developer’s Guide to Virtualization”  talk on Channel9

Physical machine to Virtual machine(P2V) using Disk2Vhd

Recently I had to work with team to move their build system to Visual Studio 2005 SP1. Currently their build system was setup with Visual Studio 2005 with various third party software , environment settings, registry changes , which are necessary to build the legacy software. Team wanted to try out Visual Studio 2005 SP1 changes on clean workstation with all necessary settings so that they could build software and run some tests and once they are confident then they can update existing build systems to Visual Studio 2005 SP1.

Unfortunately setting up new system requires lengthy process. It requires going through their build system setup documentation and making sure that all the third party software, environment variables, registry settings and other settings in proper order. This can easily take up 1/2 day of work, even then it is not guaranteed to work , because you could easily miss out some settings.

I knew that using Virtualization technologies we could do physical to virtual desk conversion but I never tried it.

Enter Physical-to-Virtual ( P2V )

Physical to Virtual Conversion (P2V) is the process by which an existing operating system on a physical server — its filesystem, applications and configuration, etc. — is cast into a virtualized instance of the same operating system and filesystem, transferred, instantiated, and started as a VM on  hosted or bare metal virtualized platform.  All major virtualization software vendor’s provides tool which can create virtual disk format from the physical disk , which is first step in P2V, VMware provides VMware vCenter Converter and Microsoft provides SCVMM (System Center Virtualization Manager) .

But each of these solutions requires installing some software. I wanted simple standalone solution, after searching on the web , found Disk2Vhd tool from sysinternals (now part of Microsoft). This tool is standalone executable, simple to use and does not require to install any software. It creates virtual appliance in VHD (virtual hard disk) format and all major vendors directly supports this format.

Once tool creates VHD file I can attach the virtual appliance into virtual machine monitor ( VMM ) such as VirtualBox , Xen,Hyper-v or VMware workstation and install the new service pack on top of the exiting virtual build machine setup.

Following section describes steps to move physical machine to virtual machine using Disk2VHD and VirtualBox software

1. Download Disk2Vhd  tool from Microsoft technet site.

2. Run Disk2Vhd tool  on a physical machine , you wish to convert to virtual . This tool list the all available drives on a system and the required disk space for storing virtual disk (VHD).

Disk2Vhd

3. After selecting the required options , select Create

To make it fast , you can select different disk location for storing the VHD file. Also make sure that you un-check all network drives and other drives which you do not wish to include .

4. Once VHD file is created , take the VHD to to different machine where Virtual machine monitor software is installed ( Hyper-V or Vmware Wokstation …etc ) , create new virtual machine and attach the VHD.

5. In this example I will uses VirtualBox VMM ( Virtual machine monitor ) to attach the VHD.

6. Create new VM in VirtualBox ( Machine->New ). In the “Create New Virtual Machine” dialog, enter name and select OS. In this case my build system was in Windows 7 , I selected the same.

image

7.Select Next and provide memory for new VM.

image

8. Select Next. In this dialog un-check “Start-up Disk” option. This allows us to attach existing VHD to VM instance.

image

9. Select Next , Following warning message is show, click “Continue

image

10. Select Next,

image

11. This will complete the creation of new Virtual machine. But still we have not configured it to use VHD file got from the P2V conversion.

From the VirtualBox Manager select the newly created VM ( p2v-win7vm) from the pane and select “Settings” options , as shown below.

image

12.In “Settings” dialog select “Storage” option on the left pane and click “+” button on IDE controller to add existing VHD . Once this option is select VirtualBox brings up dialog to choose existing disk.

image

13. Once VHD is selected, you can modify other  settings such as memory, processors and video memory from this dialog.

image

14. Now Virtual machine creation is complete , you can stat the VM, you have replica of your physical  setup inside VM.

In conclusion P2V is great technology to create copy/move your physical server instance inside VM .

Resources

1. TechNet site.

2. Free P2V software from VMware.

3. VirtualBox Virtualization software.