Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1291
  • Last Modified:

After shrinking a Hyper-V Virtual HD how to you release the unallocated space

I'm learning on a test server how to increase and decrease the size of a Hyper-V HD.  After I decrease the size, there is unallocated space left.  

How do I release it so the host can use it?

I've looked for some articles, but can't find this answer.
0
J.R. Sitman
Asked:
J.R. Sitman
  • 10
  • 5
  • 4
  • +1
2 Solutions
 
Subhashish LahaCommented:
Refer below article

http://sqlsolace.blogspot.in/2008/05/compressing-hyper-v-disk-images-vhd.html

Note: VM should be Powered Off
0
 
Svet PaperovIT ManagerCommented:
In Hyper-V Manager: convert the VHD file to dynamic and then run Compact.
0
 
J.R. SitmanIT DirectorAuthor Commented:
Tried it and it still shows the unallocated space.  I did a refresh and a rescan.

I powered it off.  Should I shut it down?
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
J.R. SitmanIT DirectorAuthor Commented:
Sorry I thought the disk was already Dynamic.  I converted it.  However, it still shows the unallocated.

What exactly is a Dynamic disk?  
Is it better for VM HD's to be Dynamic?  
Can you convert it back to basic?
0
 
Svet PaperovIT ManagerCommented:
What is the OS of the VM and how did you do the resize? Shrinking of VHD file is not suppored by Hyper-V Manager of Hyper-V 2008 R2. However, there are other unofficial methods. Which one did you use?

In some cases convering VHD to dynamic won't help with the compact: for example, if you have multiple partitions on the virtual disk, or if it's a Linux partition.
0
 
Svet PaperovIT ManagerCommented:
By converting a VHD file to dynamic I meant converting on the Hyper-V level not inside the VM.
http://technet.microsoft.com/en-us/library/cc720363%28v=ws.10%29.aspx
0
 
Subhashish LahaCommented:
No, you cannot convert Dynamic disk to Basic disk.

The Basic disk and Dynamic disk has different propertise. Read below link
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363785(v=vs.85).aspx


"spaperov" refered to Dynamic VHDs. Read below link for more information on different types of VHDs
http://www.altaro.com/hyper-v/hyper-v-guest-design-fixed-vs-dynamic-vhd/


To resize VHD, you can use VhdResizer. Refer below link for more information and to download VhdResizer
http://www.bursky.net/index.php/2013/02/resize-vhd-volumesize/
0
 
J.R. SitmanIT DirectorAuthor Commented:
The OS of the VM is 2008 R2

I right click the drive and chose shrink

Since I misunderstood the VM HD is now Dynamic

I just Extended it to the full available size.  

I have VHDresizer.  Should I use it now from the HOST?

So now how do you suggest I proceed?  Keep in mind this is a test server, so if I've screwed it up, no big deal.
0
 
Subhashish LahaCommented:
As you want to decrease the size of VHD.

First, Shrink the volume to the desired size you want inside VM i.e. in Windows 2008 R2.

Then shutdown the VM.

Open VHDresizer on Host and select VHD file

Provide new size and destination of new VHD. (Make sure the new VHD size should not be less than the volume size inside VM - otherwise Data inside VM will corrupt.)

After VHDresizer is completed, you can attach the new VHD and boot VM.

Once everything is fine inside VM, you can delete the old VHD.
0
 
Svet PaperovIT ManagerCommented:
I've already used the following procedure when I did P2V of Windows Server 2003 disks. You could give it a try:

http://blogs.technet.com/b/tonyso/archive/2008/10/09/hyper-v-how-to-shrink-a-vhd-file.aspx
0
 
J.R. SitmanIT DirectorAuthor Commented:
@subhashishlaha  I followed the steps and shrank the drive from 125 to 90.  I shut it down and ran VHDresizer.  In the new size it will only let me enter 125 or higher.  It won't let me reduce it.  See attached.
resize-VHD.png
0
 
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
Three methods to do what you ask:
http://bit.ly/12KkFYs

Note that there is a bug in Resizer (as per the linked blog post) that won't allow the smallest size. Do Smallest size +1.

Philip
0
 
J.R. SitmanIT DirectorAuthor Commented:
@MPECSInc, if you look at my last post, the problem is I can't shrink it.  It states the smallest size is 125.

So I don't know how to proceed.  See the attached in this post.
VHD-size.png
0
 
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
Isn't the drive supposed to be "FIXED"? Your original snip earlier stated "Dynamic".

Sorry, not 100% up on running the resize tool.

Philip
0
 
J.R. SitmanIT DirectorAuthor Commented:
I believe so, but in an earlier post it said to make it Dynamic, but he was referring to the Host not the VM.  However, I changed the VM.  I just tried converting it back to Fixed and it fails stating there is not enough room.

I'm getting the impression it's time to create a new VHD.  Anybody got any thoughts?
0
 
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
Not enough room on the host's storage?

Probably as the process probably needs current storage plus migrated storage available plus some space for a temporary file.

Try again. Start fresh making sure you have enough storage to make the necessary changes. At least your error was different the second time. :)

Philip
0
 
J.R. SitmanIT DirectorAuthor Commented:
I host drive is very small 150 gig.  The VM is 125, so I doubt it will work.  It's not a big deal.  I built the server strictly for testing.
0
 
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
You could go 65GB for the VM and then run through the process. 2012 Server OS will start complaining about storage if the volume to install to is less than 65GB IIRC.

Since you are looking to run a test set up in 90GB and then run through to decrease to 70GB or thereabouts. Hopefully that will give you enough room to work. :)

Philip
0
 
J.R. SitmanIT DirectorAuthor Commented:
I shrank it all the way to 40GB and it still states not enough room.
0
 
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
Your source VHD is still 125GB though.

I am saying start fresh.

Philip
0
 
J.R. SitmanIT DirectorAuthor Commented:
ok
0
 
J.R. SitmanIT DirectorAuthor Commented:
After I took the advice of starting fresh, I deleted the original VHD, created a new one, then followed the steps provided by subhashishlaha.

Thanks to all for helping.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 10
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now