Solved

Hyper v 2012 compac not working

Posted on 2015-02-21
9
63 Views
Last Modified: 2015-03-12
Hi,
Having some serious issues trying to compaq VHDx'S

Tried the GUI , powershell (http://blogs.technet.com/b/askcore/archive/2012/09/20/compacting-a-dynamically-expanding-virtual-hard-disk-in-windows-server-2012.aspx)

I dont get any error message after compacting & compac terminates OK

But when checking the size or hyper v, nothing has changed

Any tricks?

Cheers
0
Comment
Question by:defrey
  • 4
  • 4
9 Comments
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 40623873
how much free space is on the physical disk and in the virtual disk?  Perhaps there is nothing that can be compacted
0
 
LVL 1

Author Comment

by:defrey
ID: 40624075
Hi David,

VHD size is 256GB, used space is only 73.GB

Available free space on Physical 760GB

Should be able to do it!
0
 
LVL 56

Accepted Solution

by:
Cliff Galiher earned 500 total points
ID: 40624077
Keep in mind that compacting a dynamic disk only shrinks the physical file by removing empty space at the end of the file. In some situations, where data was removed in such a way where the empty space is mid-file, compacting won't do much. It does *not* defragment the vhd(x) files first.
0
 
LVL 1

Author Comment

by:defrey
ID: 40624082
Is this case, I have got over 180GB that not needed, What would you recommend?
For quick backup, I need to bring the size down.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 56

Expert Comment

by:Cliff Galiher
ID: 40624092
There are server (aka expensive) defrag tools that can move data specifically for this purpose. Otherwise there isn't a lot you can do.
0
 
LVL 1

Author Comment

by:defrey
ID: 40624100
I am confused now, What does compacting VHD do?
0
 
LVL 56

Expert Comment

by:Cliff Galiher
ID: 40624103
As I said above, it moved the "end" of the file to the last non-empty space, effectively removing any empty space at the end. If a lot of data was added to a dynamic disk causing it to grow, and then some of that data is removed, the empty space may be in the middle of the file, not the end, compacting does *not* rearrange blocks of data so it can remove that empty space.
0
 
LVL 1

Author Comment

by:defrey
ID: 40624105
Thanks Cliff, so I should be able to compac some of it without the expensive tools.

So, the question is why nothing get compacted when I try?

Cheers
0
 
LVL 56

Expert Comment

by:Cliff Galiher
ID: 40624111
Given no error is occurring, my belief is that there is data at the end of the virtual disk, thus it is as compacted as it can be without a defrag, this isn't uncommon with dynamic disks; data had to be written to the drive to grow it to the size it is, so it is common that a small chunk of data remains at the end even when some data is later deleted.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring 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.
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now