Wednesday, 5 December 2012

Configuring a W2008R2 vhd as a boot partition on my Win7 laptop.

Configuring a W2008R2 vhd as a boot partition on my Win7 laptop.

There is many version being illustrated on the web. I had tested some and the preferred method is detailed here. My intention of doing it is to allow myself a means to host various vhds with W2008 hyper-V so as to practise on the new 2012 server syllabus.

The general steps are as follows:
1. create a vdisk and mount using diskpart.
2. install an image using install-windowimage script
3. configure for booting using bcdedit

Step 1: creating a vdisk and mount using diskpart.


DISKPART
CREATE VDISK FILE=C:\VHD\<filename>.vhd MAXIMUM=25000 TYPE=EXPANDABLE
SELECT VDISK FILE=C:\VHD\<filename>.vhd
ATTACH VDISK
CREATE PARTITION PRIMARY
ASSIGN LETTER=V
FORMAT QUICK FS=NTFS LABEL=VHD

EXIT


Step 2: install an image using install-windowimage script

(At time of writing, the script had been upgraded to convert-windowsimage.)

opening a powershell, input the following to enable execution on the script:


PS > set-ExecutionPolicy RemoteSigned

Next, locate the install.wim from the installation sources and run the following:

PS C:\vhd> .\Install-WindowsImage.ps1 -WIM D:\sources\install.wim


Index   Image Name
[1]     Windows Server 2008 R2 Standard (Full Installation)
[2]     Windows Server 2008 R2 Standard (Server Core Installation)
[3]     Windows Server 2008 R2 Enterprise (Full Installation)
[4]     Windows Server 2008 R2 Enterprise (Server Core Installation)
[5]     Windows Server 2008 R2 Datacenter (Full Installation)
[6]     Windows Server 2008 R2 Datacenter (Server Core Installation)
[7]     Windows Web Server 2008 R2 (Full Installation)
[8]     Windows Web Server 2008 R2 (Server Core Installation)

Done.

PS C:\vhd> .\Install-WindowsImage.ps1 -WIM D:\sources\install.wim -Apply -Index 5 -Destination V:

Applying "Windows Server 2008 R2 Datacenter" to V:...
WARNING: This may take up to 15 minutes...

Elapsed Time: 00:10:57.6302827
Done.

Step 3: configure for booting using bcdedit
Next, configure the dual-boot via:

V:\Windows\System32\bcdboot V:\Windows

More details are available here.

And what if you already have a properly installed vhd, and just need to configure as a dual-boot partition?

You will just need to mount via GUI:



and then configure it for dual-boot via:

V:\Windows\System32\bcdboot V:\Windows






No comments:

Post a Comment