none
Split volumes on a VHD?

    Question

  • Hi,

    I have one 300Gb VHD file containing C: (O/S 100Gb) and D: (data 200Gb). How can I extract
    each of those volumes so that they reside on individual VHD's?

    So, i want to go from this:

    1 x 300Gb VHD C: (O/S 100Gb) and D: (data 200Gb)

    to 

    1 x 100Gb VHD C: (O/S)
    1 x 200Gb VHD D: (data)

    Is there a tool to do this or via powershell?

    Thanks
    Tuesday, February 17, 2015 9:27 AM

Answers

  • Hi D.Brenner,

    Would it be possible to just mount the 300GB disk, create a new .vhd for the data partition, mount the new .vhd and then robocopy the content from the old data partition to the new vhd. 

    Then delete the old data partition and extend the system partition to take up the whole of the old .vhd or shrink the old .vhd to just be the side of the system drive. This would leave you with two .vhd.

    Kind regards Michael

     

    Wednesday, February 18, 2015 2:52 PM
  • The end result, no matter the tool, is exactly the same.  If you want to end up with two distinct virtual hard drives, I don't see that SCVMM or DSK2VHD presents you with anything different than robocopy.

    Or, you can set up an evaluation copy of SCVMM and try it there.  But it will take longer to set that up than to perform the robocopy steps.  In either case, you end up with two virtual hard disks that need to be assigned to the same VM.

    None of the methods should affect any of the installed software because everything is still pointing to C: and D:.  (Of course the typical caveat applies of try it in a lab unless you want to make your production environment your lab).


    . : | : . : | : . tim

    Wednesday, March 4, 2015 8:08 PM

All replies

  • Hi,

    You can try to use "disk2vhd" in a virtual machine.

    Regards, Terry | My Blog: http://tls1.cc
    This posting is provided “AS IS” with no warranties, and confers no rights.

    Tuesday, February 17, 2015 12:45 PM
  • Thanks

    Are there any other ways to do this, as DSK2VHD does not always work?


    Wednesday, February 18, 2015 8:27 AM
  • Hi D.Brenner,

    Would it be possible to just mount the 300GB disk, create a new .vhd for the data partition, mount the new .vhd and then robocopy the content from the old data partition to the new vhd. 

    Then delete the old data partition and extend the system partition to take up the whole of the old .vhd or shrink the old .vhd to just be the side of the system drive. This would leave you with two .vhd.

    Kind regards Michael

     

    Wednesday, February 18, 2015 2:52 PM
  • Hi D.Brenner,

    >>Are there any other ways to do this, as DSK2VHD does not always work?

    In Disk2VHD , you can just select the partition D then "copy" D drive to a new VHD which contains the partition information of original VHD , you can shoutdown the VM then mount the original vhd then delete the D partition also mount the new VHD then delete C partition .

    After this you will get two disk contain C and D partition .

    In addition , you can try to mount the VM's VHD file to host , then create a new vhd through hyper-v manager , during create new vhd wizard you can select copy from the source disk , then please follow the steps above to delete the partition you do not want .

    (before this please backup that VM first )

    Michael's suggestion is easy and useful .

    Best Regards,

    Elton Ji


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .


    Thursday, February 19, 2015 12:08 AM
    Moderator
  • Hi D.Brenner,

    Elton_Ji - thanks for the comment. 

    One extra thing to add is that its also possible to create a .vhd file from disk manager so if not on the Hyper-v host and on another member server or windows client, its still possible to mount the source vhd and create a new. 

    Kind regards Michael 

    Thursday, February 19, 2015 8:30 AM
  • Hi,

    Thanks for your updates. The issues that I have encountered with Disk2VHD are
    to do with the exporting of multiple partitions located on logical/physical drive.

    In some situations, for reasons that I have not yet figured out, when using Disk2VHD,
    if you have 2 volumes (as mentioned above) such as C and D, even if you only select one
    volume to be exported to a VHD, Disk2VHD still copies the space that the 2nd volume (D)
    ocupys as part of the export. But, this does not always happen. Sometimes Disk2VHD exports
    just the partition you want exported. 

    This is the reason that I was looking for an alternative to Disk2VHD, such as some other 
    product or maybe powershell.
    Monday, March 2, 2015 10:05 AM
  • Robocopy was mentioned.  Create another VHD and robocopy the contents of the D: partition to the new VHD.  Validate that the information is correct.  Delete the D: partition on the original VHD.  Shrink the original VHD that contained both C: and D: partitions to be the size you want it.

    . : | : . : | : . tim

    Monday, March 2, 2015 7:03 PM
  • Thanks for the ideas. I am suprised that there are no tools that you can use to do this sort of maintenance on a VHD, as sometimes you don't have the option of moving data and creating new VHD's etc as suggested (thinking of things like Exch/SQL/3rd party stuff that could be installed on these partitions). 
    Tuesday, March 3, 2015 12:23 PM
  • Robocopy is a tool.  :)  How would you do that with a physical disk?  I would do it pretty much the same way as what I suggest for the VHD.  I don't know what sort of 'special sauce' you expect from a VHD, but just think of them as physical disks when it comes to tools.

    . : | : . : | : . tim

    Tuesday, March 3, 2015 5:50 PM
  • Yes Robocopy is great, and would does work as suggested, but what we are trying to do in this scenario is at a lower level :)

    The aim is to split a 1 x 300Gb VHD C: (O/S 100Gb) and D: (data 200Gb)
    in to 1 x 100Gb VHD C: (O/S) and 1 x 200Gb VHD D: (data) while keeping
    the data within each 100% intact and as it was, so that the Server sees no
    change (no data moved, databases reinstalled etc). 

    So what we are looking for is something that can do what SCVMM does, but is inexpensive
    or free (eg DSK2VHD). Maybe there is not anything

    Wednesday, March 4, 2015 11:13 AM
  • The end result, no matter the tool, is exactly the same.  If you want to end up with two distinct virtual hard drives, I don't see that SCVMM or DSK2VHD presents you with anything different than robocopy.

    Or, you can set up an evaluation copy of SCVMM and try it there.  But it will take longer to set that up than to perform the robocopy steps.  In either case, you end up with two virtual hard disks that need to be assigned to the same VM.

    None of the methods should affect any of the installed software because everything is still pointing to C: and D:.  (Of course the typical caveat applies of try it in a lab unless you want to make your production environment your lab).


    . : | : . : | : . tim

    Wednesday, March 4, 2015 8:08 PM
  • Hi, yes there are lots of ways to do this, but in this instance we are trying to find a way to do it as per: 

    The aim is to split a 1 x 300Gb VHD C: (O/S 100Gb) and D: (data 200Gb)
    in to 1 x 100Gb VHD C: (O/S) and 1 x 200Gb VHD D: (data) while keeping
    the data within each 100% intact and as it was, so that the Server sees no
    change (no data moved, databases reinstalled etc). 

    To clarify on a key issue here, the data MUST stay in the same physical location on the disk(VHD), hence copying data is not an option

    In this instance, we don't want to copy data or create new VHD's. We just need (for business reasons), to split one VHD in to 2 directly. Maybe there just is no way to do this...

    Wednesday, March 11, 2015 1:07 PM
  • The aim is to split a 1 x 300Gb VHD C: (O/S 100Gb) and D: (data 200Gb)
    in to 1 x 100Gb VHD C: (O/S) and 1 x 200Gb VHD D:

    In this instance, we don't want to copy data or create new VHD's. We just need (for business reasons), to split one VHD in to 2 directly

    Your two statements contradict each other.  First you say you want to have two separate VHDs.  They you say you do not want to create new VHDs.  It is completely impossible to have two VHDs from one VHD.  How would you accomplish that with a physical disk?  VHDs are not magic.  They follow the same rules as the physical disks.  If I have a physical disk with two partitions and I want to separate that into two separate disks, I have to copy some data.  That can be a copy or a backup, but the data has to be moved from one disk to another.  The same applies to virtual disks.

    the data within each 100% intact and as it was, so that the Server sees no
    change (no data moved, databases reinstalled etc). 

    The data will remain intact if proper tools are used to move the data.  I simply do not understand how you can expect to create a second virtual hard disk to contain the data from another virtual hard disk without moving the data to the second disk.  If done properly the server will see no change.


    . : | : . : | : . tim

    Wednesday, March 11, 2015 2:41 PM
  • We have managed to do this using the latest copy of Disk2VHD. So, it is actually possible, without having to copy files etc. Thanks for your help Michael.
    Wednesday, March 11, 2015 2:59 PM
  • Hi, care to explain how ?

    I have been doing robocopy splitting VHD's for ages.

    Friday, July 17, 2015 4:22 PM
  • We ran DSK2VHD within the running VM and created 2 new VHD's. We did not use any Cisco kit or methods.
    Sunday, July 19, 2015 8:27 AM
  • Hi Issam

    What parameters are you using with Robocopy in order to maintain all of the security and share stuff ?


    Mark Harby Nottingham, UK

    Thursday, December 21, 2017 4:02 PM
  • Same here, would like to know the switches you use.
    Friday, December 22, 2017 10:31 AM