[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2013-05-27
22
Medium Priority
?
936 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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 1000 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 39

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 39

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 39

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 39

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 39

Assisted Solution

by:Philip Elder
Philip Elder earned 400 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

656 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