Jaa


BCDBoot–one of my new best friends

I am getting ready for a series of interactive events next month and one of the things I wanted to show was a hyper-V cluster.  No doubt Simon and  could have blagged some kit, but we decided to use what we had lying around in the office.  This meant I had to muck about with my shiny Orange Dell Laptop so I eventually decided to dual boot so that I could run my old demos or use the laptop for these new events.

Currently when I run my demos I am actually booting to a VHD running windows Server 208 R2 with the hyper-V role enabled, not that boot to VHD is not virtualisation , you are just using the VHD as your hard disk.  This means you can back up the environment by just copying that VHD. What I wanted to do today was to setup another VHD for these new events and the easiest way to do that is to break out  of the windows server installation process by hitting control F10 to bring up a control screen and then use DISKPART to create and attach a VHD which you can then install the operating system to. you’ll enter command like this..

select disk 0

select partition 1

list volumes (to see which drive you want to create the VHD on)

create vdisk file=”c:\deepfat.vhd” maximum=20000 type=fixed

select vdisk file=”c:\deepfat.vhd”

attach vdisk

exit diskpart and refresh the list of volumes and you’ll see the vhd you just created and then you can select it and  install to it (this work in Windows 7 or Windows server 2008 R2). The nice thing about this is that it creates a boot entry for it.  However if the worst happens and your disk dies and you want to rest your environment on a new hard disk what do you do?  In my case I had my first boot VHD on a volume I wanted to combine with another so I needed a simple way to put the VHD on a volume and then get an entry for it in the boot menu so I could boot from it.

If you have used BCDEdit by itself you’ll be aware of how fiddly it is and if you haven’t trust me.  However Simon pointed out a related command BCDBOOT which is a lot simper to use..

simply mount the VHD so it appears as a drive letter (

select vdisk file=”c:\deepfat.vhd”

attach vdisk

assign letter v

and then run bcdboot to add an entry for it ..

bcdboot v:\windows

the only problem you might end up with (and this happened to me) is that the description for each entry will be the same so you won’t know which one to select at boot time.  You’ll have to use BCD edit for this by running bcdedit with no arguments look for the bit of the output that has the entry to your new VHD and copy its GUID to the clipboard. Now you can run

bcdedit /set (paste your GIUD here) description “meaningful description in double quotes

Update [1/12/11]

Having made these changes my original demo rig wouldn’t run hyper-V and it turned out this was because of the boot store (which is what BCDEdit writes into), so I also had to run another BCDEdit command to start the hyper-V service as part of the boot process..

bcdedit /set "{default}" hypervisorlaunchtype auto

the {default} refers to the default entry in the boot store which in my case is my demo rig, you could of course specify the GUID for a particular entry.

Hopefully this is useful but to be honest I wanted to post it so I could refer back to it later.

Comments

  • Anonymous
    November 16, 2015
    Andrew Fryer follows on from his popular Catch Up: Expanding Your Laptop With Hyper-V , taking a look at why you would use Hyper-V and what its limitations are.
  • Anonymous
    January 24, 2016
    just an update but all of this also works with later version of Windows Server (2012 2012R2 2016) and also VHDX virtual disks