none
How to reassign the parent to the exported difference disk VHD

    Question

  • Hello,

    I build my lab with differencing disk with Windows Server 2008 R2 Hyper-V and would like to ask as the below scenario.

    - I created a lab with 4 virtual machine on c:\drive using different disk configuration. (The based image located on C:\drive)

    - My C:\ drive is quite full so I export 2 virtual machines to e:\ drive

    - Exporting virtual machine with difference disk configuration also export the based image to e:\ drive

    My question is I would like to delete the based images on e:\ drive and would like to point the based image located on C:\drive instead of e:\drive.

    How I can do that?

    Thanks in advance,

    U37TCP

    Tuesday, August 16, 2011 6:28 AM

Answers

  • In your scenario it is all about the process and the order of the steps.

    1. Export.
    2. Then Import.
    3. Then break the differencing disk chan by renaming the imported copy of the Parent VHD.
    4. Then fix the differencing disk.

     

    If you modify the differencing disk chain before importing default Hyper-V actions will thwart you and attempt to modify the chain.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    • Marked as answer by u37tcp Wednesday, August 24, 2011 5:38 PM
    Wednesday, August 24, 2011 3:00 PM
    Moderator

All replies

  • You edit the differencing disk chain of the new VM.  Simple as that. 

    Use the modify disk wizard, inspect the differencing disk, and point to the origional base VHD.  The VM configuration should be using the new differencing disk (not the base VHD).  Boot the VM, delete the extra base VHD copies.

    Now, here is the gotcha - if you are using differencing disks, this isn't a big deal.  If you are using snapshots this is a mess.  As the snapshot linkage is not just in the VHD of the differencing disk, it is also in configuration records of the VM (each snapshot).  You are fine as long as you never roll back to a previous snapshot as it can try to restore you to the export copy of the base VHD.

    The way to id10t proof this is to create a base VHD.  Create a differencing disk linked to that.  Then create your VM pointing to this linked differencing disk.  Then you can revert to a clean state.  Hyper-V is not managing the first differencing disk link, so it will never mess it up.

    http://itproctology.blogspot.com/2008/05/using-single-base-vhd-to-create-many.html

     

     

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Tuesday, August 16, 2011 3:03 PM
    Moderator
  • Hello BrianEh,

    What I found is after export the disk to e:\drive and delete the Based VHD on e:\drive, then I inspect the difference disk, it has no problem. It point to the based VHD on c:\ drive.

    However, when I import the exported VMs (with deleteing the based on e:\ drive), it errors and displays as missing based VHD on e:\drive (instead of c:\drive)

    I try to find the way to change the configuration by finding the information in config.xml and .exp file but I cannot find where I can change.

    I also create the test according to the blog you mentioned.

     

    Thanks,

     

    Tuesday, August 16, 2011 5:51 PM
  • The process of Importing caused Hyper-V to "fix-up" the differencing disk path to its parent.

    Simply go back to the differencing disk and change the locaiton of its parent.  (you are so close).

    (if you copied this Export folder to antoher machine, that root VHD on C: might not exist and thus you would have a broken VM - or if simply the drive letters were different).

    If you are trying to modify the export file so that you can import over and over again you will be foiled over and over again by this 'fix-up' behavior.  The mapping of child to parent is only in the export configuration if it is a snapshot.  If it is not a snapshot then the parent VHD information is contained only in the differencing disk itself.

     

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Tuesday, August 16, 2011 6:32 PM
    Moderator
  • Hello BrianEh,

     

    What I did are as follows:

    - My scenario is on the same machine (export VMs from C:\ to E:\), when I inspect the difference disk on E:\ drive, I found that it point to C:\ drive instead of e:\drive (the based VHD from export action)

    -Therefore, the link is correct The location of parent VHD is correct (it point to drive C:\), no broken link but when I import, it said missing based VHD from drive E:\ (this is what I don't understand) and I don't know how to correct it.

    THanks :)

     

    Tuesday, August 16, 2011 7:19 PM
  • You correct it by using the "edit disk" wizard from the Hyper-V Manager, instead of the inspect disk wizard.  After you import.  (maybe I have those two wizards backward - I am trying to recall)

    On Import Hyper-V knows that the differencing disk has a parent as it inspects it, and on Import it makes sure it uses the parent VHD that is in the import directory, not the origional parent VHD.


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Tuesday, August 16, 2011 9:15 PM
    Moderator
  • Hi,

     

    You can perform the following steps:

     

    1. Import the exported VMs(now you have both the parent VHD and the differencing VHD in E:\ and you want to delete the parent VHD)

    2. Proceed to the folder where the imported VM locate in your E: drive.

    3. Rename the parent VHD to other names instead of delete it directly.

    4. In Hyper-V Manager, open Inspect Disk wizard, point to the differencing disk, then you will find the reconnect button at the bottom of the window.

     

    You can refer to the following screen shot. If you didn’t rename the parent vhd file, it’s inspect button instead of reconnect button.

     

     

     

    5. In the reconnect wizard, browse to find the original parent VHD file in C: drive.

    6. Try to start the VM. If succeed, you can delete the parent VHD in E: drive.

     

     

    Best Regards,

    Vincent Hu

     

    • Marked as answer by u37tcp Thursday, August 18, 2011 5:18 PM
    • Unmarked as answer by u37tcp Wednesday, August 24, 2011 2:53 AM
    Wednesday, August 17, 2011 2:25 PM
    Moderator
  • The thing to know about Vincent's instructions is that if the differencing disk can see its parent, then the Reconnect button does not exist, it is an Inspect button.

    You only get the option to reconnect if the parent VHD that the differencing disk is referencing cannot be found.

    Note Vincent's step 3 to rename the parent VHD.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    • Marked as answer by u37tcp Thursday, August 18, 2011 5:18 PM
    • Unmarked as answer by u37tcp Wednesday, August 24, 2011 3:05 AM
    Wednesday, August 17, 2011 5:59 PM
    Moderator
  • Hello Vincent,

    According to the above step, let me explain on what I have tested:

    1. Export 2 VMs located on E:\ drive, exporting VM also export the basedimage to E:\ drive as well

    2. I try one VM by renaming the basedimage (SC-AD, which located on E:\Lab\SC-AD\Virtual Hard Disks)

    3. At this stage, I have not yet perform "Import Virtual Machine".

    4. On Hyper-V manager, select "Inspect Disk..." and found that "the differencing chain is broken" and I reconnect to the new basedimage located on C:\drive. It seems everything went well.

    5. On Hyper-V manager, select "Import Virtual Machine..." and browse to E:\Lab\SC-AD foldoer. It show "Import Fialed. Unable to find required file or folder on E:\Lab\SC-AD\Virtual Hard Disks\BasedWin2008R2SP1.vhd"

    6. I try to open the config.xml file by changing the path of basedimage to C:\drive and also open the exp file located under Virtual Machines folder to change the based image path as well

    7. Unfortunately, I have got the same error as step 5

    Thanks,

    U37TCP

     

    Wednesday, August 24, 2011 3:05 AM
  • In your scenario it is all about the process and the order of the steps.

    1. Export.
    2. Then Import.
    3. Then break the differencing disk chan by renaming the imported copy of the Parent VHD.
    4. Then fix the differencing disk.

     

    If you modify the differencing disk chain before importing default Hyper-V actions will thwart you and attempt to modify the chain.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    • Marked as answer by u37tcp Wednesday, August 24, 2011 5:38 PM
    Wednesday, August 24, 2011 3:00 PM
    Moderator