Page 1 of 2 12 LastLast
  1.    07 Aug 2016 #1
    Join Date : Dec 2015
    Posts : 5,372
    Windows10

    Fun trying to convert an existing install to a vhd!


    This is not specifically windows 10 but I thought it might be of interest.

    I currently have dual boot 10 home and 10 pro, and it leaves the partitions decidely non-optimal. I decided I would create a virtual hard disk of the Home drive partition and delete the home partition.


    My drive is 1000 GB - partitioned as 3 drives (approx) 250 Home, 250 Pro, 500 Data.


    The Home drive only actually uses around 40 GB.


    So I used disktovhd to convert home drive (ignoring all others) to an expandable vhd (only 40 GB) on Data drive (over 400 GB free).


    I then used bcdboot command to enable booting from it, and rebooted.


    But it would not boot complaining not enough space on host (data) drive!


    I rebooted to windows, attached the vhd from disk management and I was surprised - disk to vhd nominally maps all partitions from the whole drive (ie 1000 TB) even if you do not want them! After quite a bit of googling, I discovered when you use an expandable vhd, it only loads if there is enough space to fit whole of original disk (so it can expand to that in future).


    So the vhd had nominally 750 GB of unallocated space1 More googling, and there is a tool vhdresizer which will reduce it in size. However, tool is so old, and requires a really old version of .Net, I could not get it working.


    So I thought, i will just image the Home drive partition only to the Data drive using Macrium Reflect, and convert that to a vhd. I was gob smacked to see the MRF image exhibited similar behaviour and the vhd still thought drive was 1000 GB!


    So I thought I would try creating a virtual disk and use Macrium to clone the Home drive partition to a new vhd, bbut it looked ok but would not boot.


    So, after trial an error, I finally did it using a smaller 150 GB drive in a usb caddy as follows.


    1) Image backup Home drive to Data Drive


    2) Restore backup to 150 GB drive


    3) Create image backup of 150 GB drive and convert to vhd on Data drive (I probably could have used disk2vhd for this step ie 1 action only).


    Then it worked. OK - maybe there are quicker ways but this did the job. So I was now able to wipe the home drive, and assign the space to data drive.


    The home drive vhd is on the data drive and only takes 40 GB but can expand up to 150 GB over time.
      My ComputerSystem Spec
  2.    07 Aug 2016 #2
    Join Date : Jul 2015
    Posts : 3,652
    10 Pro

    What you could do if you wanted a smaller maximum size (which you are right is the size allocated when you native boot) is make an empty vhdx max size 40GB (or whatever maximum you want), mount it and use macruim to restore the image to that. This has worked for me so I'm not sure why yours would not boot.

    Anyway good you got it working
      My ComputerSystem Spec
  3.    07 Aug 2016 #3
    Join Date : Dec 2015
    Posts : 5,372
    Windows10
    Thread Starter

    Quote Originally Posted by lx07 View Post
    What you could do if you wanted a smaller maximum size (which you are right is the size allocated when you native boot) is make an empty vhdx max size 40GB (or whatever maximum you want), mount it and use macruim to restore the image to that. This has worked for me so I'm not sure why yours would not boot.

    Anyway good you got it working
    Thanks - I'll try again- maybe it glitched or I made a mistake.

    Basically, I did the same thing with a real drive and took the scenic route .
      My ComputerSystem Spec
  4.    07 Aug 2016 #4
    Join Date : Jul 2015
    Posts : 3,652
    10 Pro

    I broke the laptop I used for work and rather than get a new one moved it onto vhd (it had a 500GB drive and as I only needed OS and programs I put it on vhd with maximum size 20GB). Works well for me but in retrospect 20GB might have been a bit optimistic. I do find that vhds grow and shrinking them never really works very well - after time the vhd is always much bigger than the space used so it is good to limit it if you can.

    One other thing to bear in mind you can't upgrade systems on vhd. You'll have to connect the vhd to Hyper-V or VirtualBox or something to do the upgrade but that is a project for next year
      My ComputerSystem Spec
  5.    08 Aug 2016 #5
    Join Date : Dec 2015
    Posts : 5,372
    Windows10
    Thread Starter

    Quote Originally Posted by lx07 View Post
    I broke the laptop I used for work and rather than get a new one moved it onto vhd (it had a 500GB drive and as I only needed OS and programs I put it on vhd with maximum size 20GB). Works well for me but in retrospect 20GB might have been a bit optimistic. I do find that vhds grow and shrinking them never really works very well - after time the vhd is always much bigger than the space used so it is good to limit it if you can.

    One other thing to bear in mind you can't upgrade systems on vhd. You'll have to connect the vhd to Hyper-V or VirtualBox or something to do the upgrade but that is a project for next year
    Yeah I tried again, and for some reason it fails whilst trying bcdboot command.
    Not a big deal.

    I was aware of vhd restriction re. build upgrades. It seems funny you can do it in hyper-v but not natively but easy enough to do but just a nuisance.
      My ComputerSystem Spec
  6.    08 Aug 2016 #6
    Join Date : Jul 2015
    Posts : 3,652
    10 Pro

    Quote Originally Posted by cereberus View Post
    Yeah I tried again, and for some reason it fails whilst trying bcdboot command.
    Not a big deal.
    Do you have UEFI or BIOS? With UEFI you use bcdboot, with bios you use bcdedit... Solved Can't native boot Hyper-V generation 2 vhdx - Windows 10 Forums

    If bcdboot isn't working you could try bcdedit...

    Quote Originally Posted by cereberus View Post
    I was aware of vhd restriction re. build upgrades. It seems funny you can do it in hyper-v but not natively but easy enough to do but just a nuisance.
    It is a nuisance and considering you can clean install to vhd it seems odd. There is some complicated technical reason I'm sure.

    I use the same vhd for both native boot and Hyper-V and it is activated with a separate license on the Hyper-V machine. When booting native it picks up the digital entitlement of the underlying hardware. When switching between Hyper-V and native boot though I do have to re-authenticate my MS ID (put in my pin) or all the store apps crash. Like you said a nuisance.

    Probably you could upgrade using Hyper-V (and Windows would be deactivated if you don't have a separate key as the machine ID is different) and it would become activated again when you native boot again but I'm not sure about that. Perhaps upgrading using Hyper-V with the virtual switch disconnected if you don't have a separate key for the Hyper-V VM would be wise.
      My ComputerSystem Spec
  7.    08 Aug 2016 #7
    Join Date : Dec 2015
    Posts : 5,372
    Windows10
    Thread Starter

    Quote Originally Posted by lx07 View Post
    Do you have UEFI or BIOS? With UEFI you use bcdboot, with bios you use bcdedit... Solved Can't native boot Hyper-V generation 2 vhdx - Windows 10 Forums

    If bcdboot isn't working you could try bcdedit...

    It is a nuisance and considering you can clean install to vhd it seems odd. There is some complicated technical reason I'm sure.

    I use the same vhd for both native boot and Hyper-V and it is activated with a separate license on the Hyper-V machine. When booting native it picks up the digital entitlement of the underlying hardware. When switching between Hyper-V and native boot though I do have to re-authenticate my MS ID (put in my pin) or all the store apps crash. Like you said a nuisance.

    Probably you could upgrade using Hyper-V (and Windows would be deactivated if you don't have a separate key as the machine ID is different) and it would become activated again when you native boot again but I'm not sure about that. Perhaps upgrading using Hyper-V with the virtual switch disconnected if you don't have a separate key for the Hyper-V VM would be wise.
    MIne is uefi. It is odd bcdboot works fine with a vhd created from an MRF image or disktovhd, but when I create a new smaller one and restore partition, it falls over. I am wondering if this is connected to the disk id in some way?

    Thinking about it, how does Hyper-v handle a vhd from a native boot? Aren't all the drivers mixed up or is it clever to change to hyper-v emulated drivers. More importantly, how does it work in reverse?
      My ComputerSystem Spec
  8.    08 Aug 2016 #8
    Join Date : Jul 2015
    Posts : 3,652
    10 Pro

    Quote Originally Posted by cereberus View Post
    MIne is uefi. It is odd bcdboot works fine with a vhd created from an MRF image or disktovhd, but when I create a new smaller one and restore partition, it falls over. I am wondering if this is connected to the disk id in some way?
    What matters is whether the vhd is formatted mbr or gpt.

    Quote Originally Posted by cereberus View Post
    Thinking about it, how does Hyper-v handle a vhd from a native boot? Aren't all the drivers mixed up or is it clever to change to hyper-v emulated drivers. More importantly, how does it work in reverse?
    It works just the same as if you clean install windows or if you pull a real disk out of one PC and stick in another. When it boots the first time it says "Getting devices Ready"... With Hyper-V all the drivers already exist in the Windows image so you don't need to load any. If you do it the other way around (make a Hyper-V VM and then native boot it) you'll need to load your drivers for display, networking and what not.

    Are they mixed up? No, not really. If you boot both ways the drivers for your real hardware and for the virtual hardware are both installed. When you boot Windows it starts the drivers based on the hardware ID (something like PCI\VEN_blablabla) so it starts only the drivers for the hardware that it finds. This will be either real hardware (native boot) or virtual (Hyper-V). The other drivers are installed but not used so you lose a (small) amount of disk space but that is all. The "Getting devices ready" message only happens the once.

    Hope that makes sense..
      My ComputerSystem Spec
  9.    08 Aug 2016 #9
    Join Date : Dec 2015
    Posts : 5,372
    Windows10
    Thread Starter

    Quote Originally Posted by lx07 View Post
    What matters is whether the vhd is formatted mbr or gpt.

    It works just the same as if you clean install windows or if you pull a real disk out of one PC and stick in another. When it boots the first time it says "Getting devices Ready"... With Hyper-V all the drivers already exist in the Windows image so you don't need to load any. If you do it the other way around (make a Hyper-V VM and then native boot it) you'll need to load your drivers for display, networking and what not.

    Are they mixed up? No, not really. If you boot both ways the drivers for your real hardware and for the virtual hardware are both installed. When you boot Windows it starts the drivers based on the hardware ID (something like PCI\VEN_blablabla) so it starts only the drivers for the hardware that it finds. This will be either real hardware (native boot) or virtual (Hyper-V). The other drivers are installed but not used so you lose a (small) amount of disk space but that is all. The "Getting devices ready" message only happens the once.

    Hope that makes sense..
    Re. vhd - I use gpt as uefi for sure.

    RE, drivers - that makes sense. Thinking about it that is sort of how wintousb works when you move a bootable usb drive to another PC (works fine for 8/10 but less so for 7 as its default drivers are getting quite long in the tooth now).

    I wonder if it would be so slick in vmware or virtualbox?
      My ComputerSystem Spec
  10.    08 Aug 2016 #10
    Join Date : Jul 2015
    Posts : 3,652
    10 Pro

    Quote Originally Posted by cereberus View Post
    I wonder if it would be so slick in vmware or virtualbox?
    I migrated a Windows 8 install from virtualbox to hyper-v and it worked fine simply by attaching the vhd to a new hyper-v vm. I had to re-activate it obviously. Not sure if you use Linux at all but Hyper-V drivers have been built into the kernel for the last few years also so it is similarly easy to move from virtual to actual hardware.

    Don't know about going the other way (i.e to VBox or VMware). I bet it would work - maybe I'll try it out when I have a bit of time.
      My ComputerSystem Spec

 
Page 1 of 2 12 LastLast


Similar Threads
Thread Forum
Clean install while keeping existing partitions?
the tutorial here says to delete all partitions before clean installing windows 10. But I don't want to do that. I just want to reinstall cleanly on the OS partition only. In the past with win7, when I had an OS and Data partition, I would...
Installation and Upgrade
Clean install with existing key
I have my Windows 10 Pro since it was available. It was upgrade from Windows 8.1 pro. I want to do clean install in a few days/weeks with the same key. 2 reasons for this: 1. I cannot pass the November update (10586) - I have tried all tips...
Installation and Upgrade
I have not been able to convert the install.esd to install.wmi
I have literally searched everywhere and all the tutorials in 5 countries say to "just convert/de-crypt the esd to wmi via a third party tool. I have tried 5 and get the same answer: "operation failed only 4 out of 5 images. I am downloading from...
Installation and Upgrade
Solved New Install - What to do about existing applications
I'm planning on moving from Win 7 to Win 10 via a new install (although it seems I should upgrade first - I'll read about that). My questions have to do with my Win 7 applications... #1) Is there a list someplace of applications that need to...
Installation and Upgrade
can i convert the disk to mbr and install Windows
Sorry if this is hijacking a thread but i have a question about this as well. I know i need to disable secure boot in order to change the boot sequence. I ran into an issue trying to install Windows 10 on a GPT partition - it said it couldn't do...
Installation and Upgrade
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 03:56.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums