Link to home
Start Free TrialLog in
Avatar of matedwards
matedwardsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Hyper-V delete Snapshot

I have deleted a snapshot of my hyper-V virtual machine to free up disk space on the Host.

I rebooted the VM.

The .AVHD file is still there and taking up space.

Can I manually delete the .AVHD file.?

Or does the VM need to be fully shutdown/turned off (from within Hyper-V Manager) for the .AVHD to be automatically deleted?

Many thanks in advance..
Avatar of Cliff Galiher
Cliff Galiher
Flag of United States of America image

Snapshot files are deleted when merged. Which doesn't require a shutdown if the OS has integration services support. But would if it doesn't.

But be cautious. It may not even be a snapshot file. Differencing disks also use the avhd file, and deleting a differencing disk from a VM that used it could be disastrous.
Avatar of matedwards

ASKER

Some Integration Services are enabled:

User generated image
How would I find out if it is a differencing disk.?

The other VM on the same host has no .avhdX file.

And I have not taken any other snapshots of either VM.

many thanks again.
Avatar of Russ Suter
Russ Suter

The first thing you need to do is determine if that AVHD is currently in use. You can do this by going to settings for the VM and looking at the hard drive info.
User generated imageIf it is using that AVHD then you might want to consider just merging it with its parent. You can do that using the Edit Disk... command and just follow the prompts.
User generated image
Thanks Ross..

From looking in Hyper-V manager the .AVHDX file is certainly in use! It's listed in the path.

Will 'merging' create a single Hard Drive file smaller than both..?

Can I do it on a live or should the VM be in a shutdown/turned off/saved state.?

Great screen shots.. thanks again..
Russ not Ross.. apologies..
When inspecting the disk from within Hyper-V Manager it is listed as

Type: Differencing Virtual Hard Disk
The merged disk is almost always smaller than the two images combined. It takes a few minutes and after it's done you're just left with the parent. You can actually do this with any differencing disk. Just merge it with its parent. If its parent is also a differencing disk it still works. You can eventually merge everything back to the original disk.

Yes, you should have the VM shut down when doing this. You don't want the VM to be writing changes to the disk while you're trying to merge it. In fact, I don't think Hyper-V even allows you to merge a disk that is currently in use.
Thanks again Russ.. I was going to do the merge at the weekend although I came across this which may cause problems.

'A merge operation might require extra space, as well. If I were to merge that differencing disk with the OS back into the empty 4 megabyte root disk, then it would need to expand the root disk to accommodate all of those changed bits. It can’t destroy the differencing disk until the merge is complete, so I’m going to need enough space to hold that differencing disk twice. Once the merge is completed, the space used by the differencing disk will be reclaimed.'

Is it true that during the merge I will need free disk space the same size as the differencing disk?

This i do not have...
ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks Russ.. will attempt out of hours..
Worked like a charm...

Many thanks, Russ..