30 comments

  1. That’s fine and dandy for those who want to mount future Windows Operating systems, but what about legacy OS’ like windows XP or Windows Vista?

    I am thinking that the boot manager itself has the capability of mounting the vdisk and if that’s correct, then mounting any pre-existing Virtual Disks you have with an Operating system installed on it, would start that operating system?

    Have you tried mounting a Windows Vista VHD using bcedit and seeing if it will boot? Or a Windows XP?

    I have been trying for some time to get it right, but no luck thus far. When your in the host operating system (Windows 7) can you run bcedit and post what the entries are to give me an idea of where I may be going wrong?

    lotacus

  2. Of course I can post my entries, I have not tried to boot a lagacy OS yet. ( i did not have time for that, ihope I have time for it next week. Below are my boot entries ( from a normel bcdedit /enum. if you like maore, mail me directly and I’ll send you more info.

    Windows Boot Manager
    ——————–
    identifier {bootmgr}
    device partition=DeviceHarddiskVolume1
    path bootmgr
    description Windows Boot Manager
    locale en-US
    inherit {globalsettings}
    default {current}
    resumeobject {6d158159-adcc-11dd-8a9d-9d3c90479382}
    displayorder {current}
    {6d15816b-adcc-11dd-8a9d-9d3c90479382}
    {6d15816c-adcc-11dd-8a9d-9d3c90479382}
    toolsdisplayorder {memdiag}
    timeout 15

    Windows Boot Loader
    ——————-
    identifier {current}
    device partition=C:
    path Windowssystem32winload.exe
    description Microsoft Windows 7
    locale en-US
    inherit {bootloadersettings}
    recoverysequence {6d15815b-adcc-11dd-8a9d-9d3c90479382}
    recoveryenabled Yes
    osdevice partition=C:
    systemroot Windows
    resumeobject {6d158159-adcc-11dd-8a9d-9d3c90479382}
    nx OptIn

    Windows Boot Loader
    ——————-
    identifier {6d15816b-adcc-11dd-8a9d-9d3c90479382}
    device file=[C:]vhd2k8toy.vhd
    path Windowssystem32winload.exe
    description Server 2008 R2 toy
    osdevice file=[C:]vhd2k8toy.vhd
    systemroot Windows
    resumeobject {70878617-b140-11dd-a15a-806e6f6e6963}

    Windows Boot Loader
    ——————-
    identifier {6d15816c-adcc-11dd-8a9d-9d3c90479382}
    device file=[C:]vhd2k8boot.vhd
    path Windowssystem32winload.exe
    description Server 2008 R2 Demo
    osdevice file=[C:]vhd2k8boot.vhd
    systemroot Windows
    resumeobject {03702d56-b142-11dd-9219-806e6f6e6963}

    I have two vhd boots: both a server 2008 R2, one for demo purposes and one to ploay around with and maybe wreck and try again.

    EricD

  3. ok great! thanks. well looking at the vhd entries, it seems that everything I had was correct, the only difference though, was the identifier it is using. It seems that it is using the same identifier for all the entries including your host machine, where my vhd identifiers were different from the host OS. Maybe that is where i went wrong, or perhaps using an identifier of {legacy}, which *should* tell the bootmanager that the VHD contains a legacy bootmanager.

    but then when it comes to the following:

    path Windowssystem32winload.exe
    systemroot Windows

    I am confused if that is pointing to the physical disk or to the file / directory within the VHD.

    lotacus

  4. Hi Dennis,

    Nice write-up, pretty appreciated. But you were a little vague on how to copy the bootloaders from the Windows 7 DVD to the local drive and activate them for an existing Vista install.

    For example I copied the files as you wrote above, renamed the old C:bootmgr and C:WindowsSystem32bcdedit.exe to *_old; copied the Win7 bootmgr to C: and the bcdedit.exe to the system32 folder.

    On running the new bcdedit (ver 6.1) got the error that the version of bcd editor will not work on the current OS (freely quoted here of course).

    It seems to therefore that your solution could only work in a Windows 7(ver 6.1) installed environment instead of the Vista(ver 6.0) environment. Or do you have another angle to solving this problem. Thanks for your information.

    McAkins

  5. Message truncated above:

    On running the new bcdedit (ver 6.1) got the error that the version of bcd editor will not work on the current OS (freely quoted here of course). Rebooting did not solve the problem
    It seems to therefore that your solution could only work in a Windows 7(ver 6.1) installed environment instead of the Vista(ver 6.0) environment. Or do you have another angle to solving this problem. Thanks for your information.

    McAkins

  6. Much to my embarrasment, discovered I got your name all wrong, should have written Eric instead of Dennis, very sloppy of me. My sincere appologies.

    McAkins

  7. Hello, Eric!

    Nice news. I was thinking about attaching the Hyper-V or Virtual Server’s VHDs to my test Windows Server 2008 R2 system setup. The reason is, I don’t plan to include the R2 machine into the production environment. However, I would like to test some real-life application that I am running there in R2 environment.
    What would be the proper command to do that and include the VHD entry into the boot menu?
    I tried the follwowing command.

    bcdedit /create /d “Windows Testbed” /application osloader /inherit device /device vhd=[d:]vhdcustomenv.vhd

    but all that to no avail.

    What am I doing wrong? The VHD file contains a boot partition with opearating system and my custom applications.

    Thank you.

    Exotic Hadron

  8. What I did to get this running, is copy the current boot entry to a new one, and edit that one, I did not create a new one from scratch… very important too is that when you create the vhd, that you surface it after that… if you forget this, (afaik) it will not boot from it, and only be available for any virtual machien tool.

    good luck

    EricD

  9. I’m still not clear on how useful this vhd stuff is. To make use of it you would need to start with Windows 7 so you can create VHD’s. Operating systems before windows 7 do not recognize vhds, so one could not install the os’ to these. So there’s no benefit in that. I’ve seldomly used Virtual PC so I dont know if VHD’s are created with it when installing virtual operating systems, so there’s also no benefit in having windows xp/vista/server VHD’s. Lets say VPC makes vhds from Virtual Operating system installs, well that’s time well wasted installing the os in a vpc, then complicatingly modifying the boot loader by hand to recognize the VHD as a bootable operating system.

    So at least in my eye’s, it’s wasted time, complicated with very little benefit. Especially if this were incorporated or “sold” as a business/corporate feature.

    What about an arugument about Operating system portability because it’s a VHD? Well that can be thrown out the window as well, until there is a dynamic boot loader, a dynamic device manager (like Linux live disks) or VHD booting capability within the bios, it will be impossible to hook up an external hard drive to a PC and boot a VHD without touch the files and disk on that particular computer.

    Unless there is something i’m missing, I just cannot see the value in this feature they implimented.

    lotacus

  10. Lotacus, I agree with you about the “lack” of usability NOW, but if NOW were the only argument ever, there would not have been progress in any subject. I see the advantage for the future, I agree that more OS-s might need to adapt to this way of working, but at least Now I can have portability of my system without using an underlying platform that eats my resources without any use except for playing the host.
    I should say, give it some time. I am happy with it for I can now use it to play around with multiple OS’s on my laptop without creating multiboots and multiple partitions. and if I muck up, the cleaning up is easy to do.

    Merry christmas to you all and a happy new Year.

    EricD

  11. Hi Eric,
    Do you have an angle for resolving the issue I mentioned above? Thanks already.

    mcakins

  12. Hello Eric,

    I found the following problems:
    – Surface is not working ==> BCDEdit gives the following alternative: ATTACH – Attaches a virtual disk file.

    When I Attach the VHD and try to install I receive the error that installing to VHD is not supported.

    Trying to install: Windows 7 Enterprise Edition Build 7000

    Have you tried this?

    Regards,

    Bas Steelooper

    Bas Steelooper

  13. Bas, it works with Windows 7 Enterprise Edition Build 7000.
    You are right, you have to use ‘Attach’ instead of ‘surface’.

    I got similar error than you, but than you just need to create a partition and format it. Than you can install it. It properly worked for me using Windows 7 Enterprise Edition Build 7000.

    Cesar de la Torre

    Cesar de la Torre

  14. Hi Guys, I did not have time to test this against build 7000, I will do so tomorrow. and I’ll keep you posted.

    EricD

  15. Eric,

    In your instruction you say:

    Bcdedit /set {GUID} device vhd=[C:]vhd2k8toy.vhd
    Bcdedit /set {GUID} osdevice vhd=[C:]vhd2k8toy.vhd

    In your bcd-dump it says:

    device file=[C:]vhd2k8toy.vhd
    osdevice file=[C:]vhd2k8toy.vhd

    Notice the difference between the word after device & osdevice (file vs vhd)

    When I use ‘vhd’ the Boot Manager gives me an error when I start the machine regarding some invalid information in the Boot Configuration Data store.
    When I use ‘file’ Windows 7 start from the vhd, but after 20 seconds I get a BSOD with error 0x0000012F and the message “An initialization failure occured while attempting to boot from VHD”

    Roel Janssens

  16. It seems that the “repair”-option is only available for drives that are not protected by BitLocker. Mine is. What can I do to “repair” the temp settings?

    Martin Born

  17. Eric, you say “at least Now I can have portability of my system”, but that’s not really true is it? Since it’s booting the VHD now rather than running it virtualized, you require all of the unique hardware drivers in the VHD now as opposed to just the VM enlightenments don’t you?

    When the VHD isn’t being booted, the virtualized hardware works, and is what enables the portability, but when you boot it, it’s no longer portable as best I can surmise.

    Jim

  18. for me the protability consists of have a multiboot and backing up my system (Laptop) without a lot of hastle, and I am able to run a newer version next to the old version, be able to figure out the stability and when proven stable, I can delete the old version.
    But in general, you are right, you cannot move my vhd from one piece of hardware to a complete other piece of hardware without the hastle of reinstalling all kinds of drivers.
    But in your datacenter, if you have standardized hardware, you machines will be portable: just pick up the vhd move it to another machine and it WILL run without that hastle.

    EricD

  19. Good article.

    Has anyone figured out how to get a legacy OS to boot off a VHD?

    I know you can’t INSTALL to a VHD from a legacy, but I have been experimenting with pre-existing VHD’s that I made up in Virtual PC.

    For instance, I have a pre-existing VHD with XP on it, but I can’t seem to get it to boot using the above BCDEDIT method. I suppose it has something to do with the boot loader methods, as XP uses “ntloader”, and Windows 7 seems to use “Windowssystem32winload.exe”

    See right now, I am dualbooting XP and Windows 7 from seperate drives, and when I look at the entry for XP I see this:

    Windows Legacy OS Loader
    ————————
    identifier {466f5a88-0af2-4f76-9038-095b170dc21c}
    device partition=E:
    path ntldr
    description Earlier Version of Windows

    Most likely it’s ignorance on my part, as I have not played around with the bootmanager in Vista at all, so I don’t know a lot of the commands. I just can’t seem to figure out how to get my XP VHD to have similar settings though.

    So I imagine it WOULD be possible to boot from a VHD with XP (or any other legacy OS for that matter) wouldn’t it?

    ______________________________________________________________

    As far as the usefulness goes, once the technology gets honed out, this could actually change the dynamics of partitioning. Think about it, if you want to set up a beta OS, or even check out a linux distro and only have one hard drive, but it’s plenty big, then you just use a VHD. As it stands, the OS takes up the whole hard drive unless you partition in advanced. Or you have to use an extra program to play around with the partition setup like Partition Magic.

    IMO simply booting from a VHD can simplify all this. Granted the process of setting up a bootable VHD needs to be simplified, but this is just in the making.

    Jordan

  20. I agree with you on your partitioning standpoint, I am very curious on how other and legacy OS-es will proceed in supporting this. AFAIK when trying to boot from VHD, the OS loader needs a driver to open the VHD and then gives the rest to the booting OS, this needs drivers to boot further. XP does not support this. the VHD is a filesystem now, it is not an emulated or other “HARD DRIVE” I do not think that now other OS-ES than windows 7 and Windows server 2008 R2 will be able to boot from VHD. this may come for vista and Windows server 2008 in a future Service pack.
    Other vendors I am not sure that they will support booting from VHD very soon.

    EricD

  21. I fixed the BSOD by creating a fixed size vhd instead of the (default) dynamically expanding vhd.

    Was type=fixed always in your manual? If so, why did I skip that part?

    Roel Janssens

  22. It has always been there, although I have experienced the expandable option to be working from build 7000. In the previous build it only worked with fixed vdisks, a differential disk did not work either. I have not tried that yet, but afaik that should work now too.

    EricD

  23. Yesterday night I discovered a quicker/easier way to accomplish a VHD-boot.
    Later in the evening I read a thread somewhere that confirmed my findings.

    —————————————————————————————-

    Boot your machine from the Windows 7 DVD/USB

    At the install screen press Shift-F10 to get a command prompt

    Type ‘dir’ to see which drive letters are assigend and where your vhd should go

    diskpart

    create vdisk file=c:vhdwin7.vhd type=fixed maximum=40000

    select vdisk file=c:vhdwin7.vhd

    attach vdisk

    exit

    setup

    —————————————————————————————-

    So no need to create a boot entry before starting the installation and no need for cleaning up the boot configuration database afterwards.

    Roel Janssens

  24. I think this is only possible:
    a) from build 7000 and
    b) when not installing next to Vista, but on a windows 7 install,
    I think i will go try this in two weeks when I am goint to rebuild my machine, ( this all depends on the app-V client and its compatibility with windows 7. and the time I have to create the streams of all my applications…

    EricD

  25. Eric (and those that also think all the above is cool stuff), on the Microsoft forums I’ve posted a solution to also boot from a differencing disk:

    http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/c7189892-ba70-4348-a952-79c50317ecc9

    Have fun rebuilding your machine, let us know when (and how) the project is finished 😉

    Roel Janssens

  26. Can anyone move the vhd file to an external drive and boot from there?

    Larry

  27. Syed and others trying this, be aware that this feature needs both support from your boot mechanism, AND the OS you are booting… This means, if it was not supported in the OS you are trying to boot, it will not work when using the bootmanager from Windows 7. The bootmanager only opens up the VHD file and points to the file necessary to proceed booting. If that file does not have knowledge on how to handle VHD files natively, it will fail.

    EricD

  28. Larry, I tried booting from a vhd placed on an external USB-HDD, but I didn’t succeed. I can remember reading somewhere that for now booting is only supported on internal fixed disks.

    Roel Janssens

  29. I might add to that, that this also depends on the moment the external drive is recognized. I can imagine, ( I have not tried this, ) that If I boot from that external drive, that you will be able to boot from VHD on that same Disk.
    I can imagine that the boot manager being on the internal dis, it is a delicate process of booting to something not native, that somewhere inside the boot process you might lose connection to the external drive because of a driver load or something else.
    Just my two cents.

    EricD

  30. I successfully Installed Windows 7 build 7000 in a VHD file
    along side my XP x64 installation

    XP was already installed
    I booted from the Windows 7 DVD
    opened a CMD prompt
    created and mounted a fixed VHD
    Installed Windows 7 to it.

    Now I’m wondering what if I tried the same time with Vista x64… would it work?
    Or what if with 2 DVD drives, one with Windows 7, the other with Vista
    I boot from the Windows 7 DVD, create an other VHD the same way I did before
    and then instead of starting Windows7 Setup… I strated Vista’s setup….

    would that work?

    I’ll be trying this later tonight….

    Joao

Comments are closed.