Virtualize Win8.1: BIOS + MBR Physical Partition > to > WIM Image > to > UEFI GPT VHD

Discussion in 'Virtualization' started by crashnburn, Jul 13, 2015.

  1. crashnburn

    crashnburn MDL Addicted

    Mar 18, 2010
    574
    25
    30
    #1 crashnburn, Jul 13, 2015
    Last edited: Jul 13, 2015
    Virtualize Win8.1: BIOS + MBR Physical Partition > to > WIM Image > to > UEFI GPT VHD


    Virtualizing Win8.1 from BIOS + MBR Physical Partition > to > .WIM Image > to > UEFI GPT .VHD


    Sometime last year I found out about Native boot VHDs and tried to go that way for good. There were some issues with hardware and OS (Win7 at the time) not working out and lot of new things that I was learning about VHDs.


    Anyways, that confusion, learning and failure led to a better path :)


    So this 2015, I figured out how to get VHDs (with Fresh Win 8.1 Installs via Install.WIM DISM Apply Image) to Native Boot on Surface Pro 3 (Sp3).


    I am going to attempt doing the following steps using DISM/ ImageX:


    MBR [Customized Win 8.1] (Physical) > Create Image > [Customized Win 8.1 .WIM] (Virtual - File based so - No sectors or MBR/GPT?? ).


    [Customized Win 8.1 .WIM] (Virtual) > Apply Image > [Empty New GPT .VHD] (on SP3)


    My thought is that by going to .WIM I bypass the whole converstion drama between MBR/BIOS & GPT/UEFI as the .WIM is agnostic of both of them? Is this a valid thought or not?
    Thoughts?


    NOTE: I can.. try out the above with creating a small FRESH MBR Windows 8.1 partition on X61T/ T61 and then doing the above 2 steps. Convert it to a .WIM and then applying to a GPT .VHD


    I am guessing a SYSPREP is recommended somewhere in between.
    Someone somewhere also mentioned doing Sysprep in a VM/ Hyper V instead?


    Thoughts? Where and how would you recommend applying the SYSPREP?
     
  2. Verified

    Verified MDL Novice

    Jul 7, 2015
    7
    3
    0
    Do you want GPT partitioning for the device holding the VHD(X)? Or do you want the VHD(X) itself GPT partitioned?

    Anyway, remember: GPT was a solution for partitioning devices over 2TB (something MBR can't do). It also allows for a lot more volumes on a single device.

    None of these benefits seem to help with your original problem: "... some issues with hardware and OS (Win7 at the time)".

    I am a very happy user of VHD's (7/8/10) and even use multiple children per parent-VHD. I have this running on a MBR SSD in an ordinary PC. Maybe I can provide some help. Don't know anything about the Surface Pro 3 though.
     
  3. crashnburn

    crashnburn MDL Addicted

    Mar 18, 2010
    574
    25
    30
    The Blank new VHD will be GPT partitioned. Because newer machines including the SP3 are easier to work with using UEFI (and MBR/BIOS/Legacy / mixed boots seem to create trouble.) Forget the Surface Pro 3 etc. Focus on the BOLDED question and original post.

    Anyways, irrespective of this stuff.. this is my contention..
    By going to a Sysprepped .WIM as an in between stage, I isolate the MBR/BIOS world from the GPT/UEFI world.. right? As none of that information gets stored in a .WIM image?

    My dear friend.. that Win 7 thing is history.. its a long thread on multiple forums that I'd rather not talk about. Bottomline, it was tough to make Win 7 run on newer machines.. SO...I went to Win 8/ 8.1 - One issue resolved.

    Brilliant.. I like the fact that you are living in VHD world (be relatively free from Partition Management land) (and I'd love to seek your guidance and experiences),
    I intend to slowly migrate into that world completely - Starting with this above posted project first.
     
  4. Verified

    Verified MDL Novice

    Jul 7, 2015
    7
    3
    0
    #4 Verified, Jul 15, 2015
    Last edited: Jul 15, 2015
    Sysprepping is the art of manipulating an OS to your liking before an enduser starts the out-of-box-experience. Sysprepping itself will not give you a WIM. "DISM /Capture-Image ..." does that for you.

    If I were to try your scenario I would:
    - boot Win81 installation media.
    - Go to DOS (Shift-F10) in stead of proceeding with an installation.
    - Start diskpart.
    - Attach the MBR style VHD. Identify your physical partition.
    - run DISM /Capture-Image /CaptureDir:X:\ ...
    * Since you're capturing a directory there is no record of the physical properties of the partition/volume it was in during capture (like you assumed).
    - Create or attach a VHD initialized with a GPT layout.
    - run DISM /Apply-Image /ImageFile:image-from-X.WIM ...
    - delete image-from-X.wim.
    - reboot to MBR-style VHD.

    To boot your new VHD I recommend you add it as a second entry in the bootmanager.
    - bcdedit /copy {current} /d "Same OS, GPT layout"
    - bcdedit /set {id-given-to-the-new-copy} device vhd=[X:]\your-GPT-VHD.vhd
    - bcdedit /set {id-given-to-the-new-copy} osdevice vhd=[X:]\your-GPT-VHD.vhd
    - bcdedit /set {id-given-to-the-new-copy} path \Windows\system32\winload.exe
    - bcdedit /set {id-given-to-the-new-copy} systemroot \Windows

    My guess is you can boot this second entry without problems.

    Edit: Rereading the thread I understand there is no longer a VHD present at the moment, just a "System Reserved Partition" for BCD and a second partition with your OS (on a physical drive initialized as MBR). Right?
     
  5. Verified

    Verified MDL Novice

    Jul 7, 2015
    7
    3
    0
    Rereading the thread once more: I get the feeling you want to rid yourself of the legacy compatible BIOS boot and switch to UEFI (while keeping your OS and moving it to a VHD). I have never seen a recipe for that.

    If I were to try I'd break it down to this:
    - FOR A RECOVERY: image the BCD partition, image the OS partition, save the partition table, save the MBR to external media. Use a Linux live-cd (ntfsclone, sfdisk, dd) or any Bare Metal Recovery software you trust.

    - run DISM /Capture-Image /CaptureDir:X:\ ... CaptureFile goes to external media aswell.
    - clean the disk.
    - boot Win81 USB Media in UEFI-mode.
    - do a vanilla install (Windows installer will init the disk as GPT and make all necessary volumes (more than your familiar two)).
    - test a UEFI boot into Windows with none of your apps or documents.

    Continue with previous guide:

    - Create or attach a VHD initialized with a GPT layout.
    - run DISM /Apply-Image /ImageFile:image-from-X-on-external-media.WIM ...

    To boot your new VHD I recommend you add it as a second entry in the bootmanager.
    - bcdedit /copy {current} /d "My old OS, GPT layout"
    - bcdedit /set {id-given-to-the-new-copy} device vhd=[X:]\your-GPT-VHD.vhd
    - bcdedit /set {id-given-to-the-new-copy} osdevice vhd=[X:]\your-GPT-VHD.vhd
    - bcdedit /set {id-given-to-the-new-copy} path \Windows\system32\winload.exe
    - bcdedit /set {id-given-to-the-new-copy} systemroot \Windows

    My guess is there are subtle differences between what Windows installs in UEFI-mode and legacy-mode. This is likely to prevent you from loading the OS in the VHD. You can quit and restore your backups -or- reinstall all your programs and move your settings/documents to the vanilla UEFI Windows. When you're done, a second run of DISM /Capture-Image and DISM /Apply-Image can move your UEFI/GPT-aware OS to a VHD as described.
     
  6. crashnburn

    crashnburn MDL Addicted

    Mar 18, 2010
    574
    25
    30
    #6 crashnburn, Jul 19, 2015
    Last edited: Jul 22, 2015
    (OP)
    UPDATE and PROTOTYPE SUCCESS:

    PEOPLE, FRIENDS, FORUM MEMBERS, ADMINS & MODS :) - Thanks.
    I appreciate all the help and cautionary words and I am listening to it all during my experiments. Yes, the goal seems a bit complicated and ambitious but isnt that what we help each other with?

    Anyways, I was able to achieve "Success" this weekend using ONE pathway for Steps A, B, C outlined below. I'd love it if you can please help me with Steps A, B, C - specific to the other pathways that I have not used or run yet.

    HISTORY 2014:
    I tried a similar exercise last year (around Aug 2014) which did not go all the way for various reasons. One large one might be that I was trying to run Win 7 on a new Win 8 machine..

    GOAL:
    So, my goal to Migrate
    FROM: (My Win 8.x x64 OS + Apps + Settings + Data) on (MBR/BIOS) machine Thinkpad T6x/X6x
    TO: Semi-portable (UEFI/GPT).VHD that works on UEFI only machines (and GPT also because makes UEFI life easier) (current: Surface Pro 3 for traveling.. will buy new UEFI machine for more processing power). Just copy VHD to internal SSD/ HDD, BCDBoot and go.

    (The mixed mode variations between MBR/BIOS and UEFI/GPT worlds I havent tried much as its a bit wonky. I may have encountered them last year but easier to stick with one of the extremes)

    PROJECT BREAKDOWN:
    My PROJECT INTENT has the following steps:

    A - Cleanse / Hardware/ Drivers Information -
    Only ways I found was Manual/ Forced Uninstalls of Drivers and Sysprep (apparently does so).
    Paragon has an Adjust OS and some other tools that I have yet to try

    B - Image the existing Drive/ Partition(s) to VHD -

    ImageX (deprecated)
    DISM - I've been using it to Apply Images (Win 8.x) to test VHDs.
    Looking at using it to Image the Partitions/ Disks instead of Disk2VHD as it could give me more granular control.
    /CaptureImage and /ApplyImage

    Disk2VHD - Does a nice job of pull the OS into VHD, but it pulls HDD info as it is:
    - Boot Info
    - Sector Info
    - MBR/BIOS Info

    C - Boot Information
    BCDedit - Seems to be the way before, but now I think the following two are what I use.
    BCDBoot - Simple to use
    EasyBCD - I use it mainly as a supplementary tool
    - Verify/ Rename/ Cleanup/ Delete - The Entries made by BCDBoot

    SUCCESS STORY 2015 - Ran this on a fresh installed Win 8.x:

    What I was able to achieve so far :)

    A - Did some stuff manually, but was not able to get Sysprep /GENERALIZE /OOBE work yet. I know the tools intended purpose is not this, but PLEASE help me with "what it does" "how I can leverage what it does" instead of telling me NO.
    Or
    Tell me what other ways: Tools, Apps, Scripts I could use for Step A

    B - I figured given Windows 8 having lot of Native Driver/ Hardware Support it might adapt
    Disk2VHD the fresh Win 8.x install.
    Ended up with a MBR .VHD > GPTGEN > GPT .VHD
    Ran GPTGEN on it (thanks to the steps & tutorials from last year)

    C - Just ran a simple BCDBOOT with GPT .VHD... Voila :) Success.
    I was able to boot in, out, etc.


    I could do the same with My main Win8.x OS Disk, but would like to have a better way for Steps
    A - Sysprep /Generalize OR
    B - DISM /Capture-Image with /CaptureDir (from Disk to .WIM) and /ApplyImage to fresh .VHD
    C - BCDBoot Seems to work easy breezy :)

    So, please share ways and means on how I could improve for A, B

    PS: I have access to Pro and Enterprise Licenses so please do not make that a concern right now. MS Gold Partners / MSDN/ etc etc.
     
  7. crashnburn

    crashnburn MDL Addicted

    Mar 18, 2010
    574
    25
    30
    Yes, I agree, understand and am aware of that :). PS: I still appreciate your inputs big time. Lunch on me :)

    But, I wanted to DISM /Capture Image to a .WIM from a Partition OS which does not have any PREVIOUS HARDWARE & DRIVER INFORMATION. So Sysprep as a PRE capture CLEANSING step.
    Is there any other way of doing this besides SysPrep?

    This little piece I missed/ did not realize. Thank to you I will make a note of it :)

    Well, creating a blank GPT VHD or Vanilla Win 8x GPT VHD should be easy :)

    Current MBR HDD I purposely eliminated the SysR & MSR/ EFI etc partitions as Win 7 & 8 can run off the Main OS Partition without the SysR 200/350M partitions
    (Just wanted to simplify things as I could easily run a Single Volume Win 8.x VHD without them).

    I am curious though, if a fresh Vanilla Win 8.x install on Single Volume would work without the said partitions.

    This is an interesting part. I was able to get a VHD to work without the [][] Pre Main OS partitions (because the new UEFI SPro 3 has an existing OS & Sys/MSR etc partitions).

    I will though conduct a trial run with your below outlined process as well. To see how a VHD performs with the other [SysR][EFI/MSR] Inited Pre OS Partitions.


    Wow.. I really really appreciate your insights and all the steps. I owe you lunch and more.

    In my experience yesterday, BCDBoot has been phenomenally simple in getting my Prototype Win8.x Vanilla Install (MBR/BIOS > Converted by GPTGEN.EXE > GPT/UEFI) to Boot by Adding Boot Entries.

    The only change I saw between the two (via Easy BCD) was:
    ..\winload.exe
    ..\winload.efi