?
Solved

Hyper-V - copying dynmaic VHD to fixed VHD

Posted on 2010-01-09
9
Medium Priority
?
1,198 Views
Last Modified: 2013-11-06
I have a 2008 R2 HyperV Dynamic VHD. I want to copy it to a blank Fixed VHD I've created.  ? I know I could do it with Ghost. Are there any other strictly Windows methods I could use to achieve the same effect?
0
Comment
Question by:lineonecorp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 22

Accepted Solution

by:
Syed Mutahir Ali earned 400 total points
ID: 26275712

http://joeelway.spaces.live.com/blog/cns!2095EAC3772C41DB!1748.entry

If you use Hyper-V without Virtual Machine Manager 2008 then you can do this using the Hyper-V console.  Edit the virtual machine in question (if applicable), select the disk and click on .  Choose to convert the disk.  You'll then be asked where to place the new disk.  Be wary here if you use dedicated volumes for each VM, e.g. in a Windows 2008 cluster.  There may not be enough disk space in the existing disks volume for the new fixed sized disk that will be created - that's correct; it doesn't convert the disk, it creates a new one.  Choose a suitable temporary location and name.  For example, my VHD might be called Disk0.VHD and I'd convert to Disk0Full.vhd.  When finished, I'd rename them, e.g. Disk0.VHD -> DiskDyn.VHD and Disk0Full.VHD -> Disk0.VHD.  Swap the files and then restart the VM.

It's both easier and more complex using VMM.  You can select the VM in question and select the disk.  Tick the box for "Convert to Fixed Type Virtual Hard Disk" and apply the changes.  A new job will start.  This creates a new VHD in the same volume as the existing VM.  That's a bit nasty.  You tend to limit the size of the LUN in question to avoid wastage when using a cluster.  So odds are, this will fail unless you've plenty of spare space in the LUN - remember the LUN will contain both the original dynamic disk and the converted fixed size disk for at least a short period of time.  Temporarily increasing and decreasing the volume size should not be done, even if your SAN can do it ... my testing phase showed that it corrupts the contents of the volume.  The nice bit of this process is that all the file renaming and swapping is done for you.  I just wish you could pick a temporary location for the file conversion process.  That might be possible using PowerShell.
0
 

Author Comment

by:lineonecorp
ID: 26275769
We found a problem with the conversion business.  We originally had a physical drive that we imported into a Dynamic VHD - the process shrunk the drive in the process in the sense that unused space in the original physical drive was mapped out of the Dynamic VHD - it 'shrunk' the drive. We then wanted to convert it to a fixed size that was bigger than the conversion to Dynamic had allocated but less than the original physical disk size. However, the conversion wanted to create a fixed disk as big as the original physical disk. So what I want to do is create the Fixed VHD a specific size and then copy the Dynamic to that VHD.  With Ghost I have the option to make the target a different size than the source so it would do what I want. I just wanted to see if there was a way to do it with Windows. Do you know of a way to duplicate the Ghost trick with just Windows?  Or alternatively do you know of a way I can convert the Dynamic to a specific Fixed size in my situation so that it doesn't revert to the original physical size?
0
 
LVL 59

Expert Comment

by:Darius Ghassem
ID: 26283184
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:lineonecorp
ID: 26286214
As I wrote earlier, that's what we tried to do and it would only create a fixed VHD that was the same size as the original physical disk. In other words let's say we started with a physical disk that was 200 gig. When it was imported and converted to a Dynamic VHD the Dynamic VHD was 100 gig.  When we then tried to convert it to let's say 150 gig Fixed VHD it wouldn't allow it  - it wanted to create a Fixed VHD that was at minimum 200 gig - the original physical disk size.
0
 
LVL 22

Expert Comment

by:Syed Mutahir Ali
ID: 26286659
how much space does it shows as used when you boot up with a dynamic vhd in the virtual machine ?
You can try a test,
create a fixed vhd, convert it to dynamic and then convert it to fixed disk to see what happens, I suspect its because it has set itself a marker of some sort so it won't reduce to your specified size.
the test can reveal that ; i haven't got a hyper-v box at the moment as i am travelling but I will try to check this asap and will post back.
0
 

Author Comment

by:lineonecorp
ID: 26289977
I'll see about trying the test and wait for you when you get back.
0
 
LVL 59

Assisted Solution

by:Darius Ghassem
Darius Ghassem earned 400 total points
ID: 26293089
0
 

Author Comment

by:lineonecorp
ID: 26326188
I will give this a try hopefully this weekend if I can schedule some down time.
0
 
LVL 15

Assisted Solution

by:msmamji
msmamji earned 400 total points
ID: 26420973
For VHD Resizer to work, the volume/partition needs to be shrunk. There are a limitation here. Shrinking of a volume is not supported on all Windows OS (if I remember correctly) like Windows Server 2003 and earlier.
Secondly, Shrinking is a basically defrag operation followed by marking the new volume limit. So if there are some unmovable files anywhere in the volume, you wont be able to shrink beyond that.
Once you shrink the volume, VHD Resizer recognize, unallocated space and lets you resize the vhd to that point. Which brings me to my point.
Both VHD resizer and convert disk (in Hyper-V) option check the volume size( as the VM see it) and only allow to resize (shrink) to space used by partition(s) on the volume, i.e  unallocated space can be redeemed.
You might have noticed that using Ghost to make a new resized VHD and then booting the VM, you see the VM's OS complain that volume size has changed (without its knowledge). Which can be risky, if you delete the source VHD without checking the destination VHD first. Only to find out that destination VHD corrupted.

Hope that helps.
P.S: Excuse me for using too many brackets.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, Virtual Machines are used equally by small and large scale organizations. However the issue is that VMDK files are also prone to corruption. So, in this article we are looking at how to recover VMDK files from hard disk of host operating s…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question