Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Shrink VHDX Server 2012 Hyper V 2012

Posted on 2016-08-05
4
Medium Priority
?
33 Views
Last Modified: 2016-08-10
I have an exchange server 2013 that I've recently free'd up lots of space on, it was 1.6 TB but is now 400Gb, I therefore thought if i compact the vhdx file through the disk management in Hyper V, it would then show as 400gb rather than 1.6TB but it hasnt changed, is there something i'm missing?
0
Comment
Question by:dannyfccs
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 41745041
It depends on where the data is geometrically speaking on the disk.  You might have to defrag the disk.

Fastest thing might be to create another VHDX on another set of spindles, shut down exchange, move the database to that other VHDX.  Then try to shrink the drive and then move the VHDX back.
1
 
LVL 17

Expert Comment

by:bigeven2002
ID: 41745097
Hello, first things first, backup your data before proceeding.

In prior Hyper-V versions, you had to shutdown the VM and then run the pre-compact tool which would reorganize the data in the VHD file and zero out free space in the VHD, so as to make the actual compact process possible.  I think it is also this way in 2012 but not sure about 2012 R2.

So in addition to the defrag above, shutdown the VM, run the precompact tool (you may have to download it), then re-run the compact function in Hyper-V Manager.  With 1.6 TB, this process can take several hours.
0
 

Accepted Solution

by:
dannyfccs earned 0 total points
ID: 41745145
I found this was the best option, open power shell elevated as administrator.

type in diskpart

select vdisk FILE="C:\HyperV\Virtual Hard Disks\vm01.vhdx"  (vhdx location)
compact vdisk

worked a treat
0
 

Author Closing Comment

by:dannyfccs
ID: 41750102
it was the best solution
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…
Suggested Courses

824 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