Solved

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

Posted on 2013-05-27
22
738 Views
Last Modified: 2014-11-12
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
Comment
Question by:J.R. Sitman
[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
  • 10
  • 5
  • 4
  • +1
22 Comments
 
LVL 10

Expert Comment

by:Subhashish Laha
ID: 39199419
Refer below article

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

Note: VM should be Powered Off
0
 
LVL 20

Expert Comment

by:Svet Paperov
ID: 39199425
In Hyper-V Manager: convert the VHD file to dynamic and then run Compact.
0
 

Author Comment

by:J.R. Sitman
ID: 39199452
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:J.R. Sitman
ID: 39199487
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
 
LVL 20

Expert Comment

by:Svet Paperov
ID: 39199490
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
 
LVL 20

Expert Comment

by:Svet Paperov
ID: 39199496
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
 
LVL 10

Expert Comment

by:Subhashish Laha
ID: 39199497
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
 

Author Comment

by:J.R. Sitman
ID: 39199541
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
 
LVL 10

Accepted Solution

by:
Subhashish Laha earned 250 total points
ID: 39199570
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
 
LVL 20

Expert Comment

by:Svet Paperov
ID: 39199580
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
 

Author Comment

by:J.R. Sitman
ID: 39199649
@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
 
LVL 38

Expert Comment

by:Philip Elder
ID: 39200158
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
 

Author Comment

by:J.R. Sitman
ID: 39202459
@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
 
LVL 38

Expert Comment

by:Philip Elder
ID: 39202811
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
 

Author Comment

by:J.R. Sitman
ID: 39202910
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
 
LVL 38

Expert Comment

by:Philip Elder
ID: 39202925
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
 

Author Comment

by:J.R. Sitman
ID: 39202966
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
 
LVL 38

Expert Comment

by:Philip Elder
ID: 39202977
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
 

Author Comment

by:J.R. Sitman
ID: 39203056
I shrank it all the way to 40GB and it still states not enough room.
0
 
LVL 38

Assisted Solution

by:Philip Elder
Philip Elder earned 100 total points
ID: 39203070
Your source VHD is still 125GB though.

I am saying start fresh.

Philip
0
 

Author Comment

by:J.R. Sitman
ID: 39203151
ok
0
 

Author Closing Comment

by:J.R. Sitman
ID: 39206560
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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In this video tutorial I show you the main steps to install and configure  a VMware ESXi6.0 server. The video has my comments as text on the screen and you can pause anytime when needed. Hope this will be helpful. Verify that your hardware and BIO…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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