Boot Windows 7 from VHD

# Boot from the Windows 7 or Server 2008 R2 media.
# Select language options and click Next.
# At the Install Now screen, press Shift and F10 simultaneously to open a command prompt window.

Enter DISKPART command

Create a VHD file on the C drive. In this example, I've created it as a 25 GB file that is an expandable disk. You can use "type=fixed" instead of "type=expandable" to create a fixed-size VHD. A fixed-size VHD will use space on the physical disk equal to its full size as soon as the VHD is created but will give better performance, so I recommend fixed-size disks for uses other than testing

create vdisk file=c:\win7ult.vhd maximum=25000 type=expandable
select vdisk file=c:\win7ult.vhd
attach vdisk
create partition primary
format fs=ntfs label="Win7Boot" quick

You can now list your volumes with the command
list vol

Exit Diskpart and close the command prompt window by entering the "exit" twice.

Proceed with the installation. When you're asked to select the installation target, choose the VHD partition you created. The installer will warn that you cannot install it on the partition, but you can ignore the warning.

Installation will now progress as usual. Once installation is finished, you can see that the VHD partition is now the C drive while the partition containing the VHD files is demoted down to the D drive

If you want to do it otherwise within Windows7:
http://blogs.technet.com/aviraj/archive/2009/01/17/windows-7-boot-from-vhd-first-impression-part-1.aspx
http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx

Booting from WindowXP:
To write the new Windows 7 or Windows Server 2008 R2 bootloader:

BOOTSECT /NT60 C: /FORCE /MBR

To create a BCD store from the Windows VHD:

DISKPART
SELECT VDISK FILE=C:\BOOTVHDS\W2K8R2ENTX64.VHD
ATTACH VDISK
ASSIGN LETTER=X
EXIT
BCDBOOT X:\WINDOWS /S C:

Set up the VHD native boot:

BCDEDIT /SET {default} DEVICE VHD=[LOCATE]\BOOTVHDS\W2K8R2ENTX64.VHD
BCDEDIT /SET {default} OSDEVICE VHD=[LOCATE]\BOOTVHDS\W2K8R2ENTX64.VHD
BCDEDIT /SET {default} DETECTHAL ON

Set up the legacy boot:

BCDEDIT /CREATE {ntldr} /d "Chain Legacy Bootloader"
BCDEDIT /SET {ntldr} DEVICE PARTITION=C:
BCDEDIT /SET {ntldr} PATH \ntldr
BCDEDIT /DISPLAYORDER {ntldr} -ADDLAST

To put things back to normal, should you ever need to:

BOOTSECT /NT52 C: /FORCE /MBR

how to build a bootable Windows 7 VHD image from a Windows 7 “install.wim” file using diskpart.exe and imagex.exe:
http://www.microsoft.com/DOWNLOADS/details.aspx?familyid=80EDE31D-3509-407B-A896-0BEEA8705589&displaylang=en

source:

http://windowsitpro.com/windowsnt20002003faq/article/articleid/101456/q-how-can-i-install-windows-7-or-windows-server-2008-r2-to-a-virtual-hard-disk-vhd-file.html

http://jordydeveloperexperience.blogspot.com/2009/11/windows-7-bootable-vhd-diskpart.html

http://blogs.msdn.com/b/cmayo/archive/2010/03/05/adding-a-native-boot-vhd-to-windows-7-part-1.aspx
http://blogs.msdn.com/b/cmayo/archive/2010/03/08/adding-a-native-boot-vhd-to-windows-7-part-2.aspx
http://blogs.msdn.com/b/cmayo/archive/2010/03/10/adding-a-native-boot-vhd-to-windows-7-part-3.aspx

Geen opmerkingen: