VMware Communities
chrisbateman
Contributor
Contributor
Jump to solution

vmdk does not shrink

I have a Windows XP guest on Fusion 3.1.0 and the VM files seemed too big so I've been trying to shrink them. The problem is that the vmdk does not shrink.

I've deleted all snapshots (and manually got rid of some "orphaned" vmem and vmsn files that were left over).

In Windows the C: shows as ~15GB used / ~25GB free / ~40GB total. In Finder the vmdk is ~43GB (presumably the 43 is because Snow Leopard is 1000^3 based).

I've tried shrinking from within the guest/VMware Tools a few times - doesn't significantly alter the vmdk size, still ~43GB. Also tried Cleanup disk option from the host/VM settings disk options - doesn't help. The virtual disk is not (and has never been pre-allocated). It was split in to 2GB chunks, but I've also tried consolidating to one big file - doesn't help. I've tried zero-ing free space (using Sysinternals sdelete /z) - doesn't help.

How can I get back my 25GB?

Thanks

Chris

Reply
0 Kudos
1 Solution

Accepted Solutions
ColoradoMarmot
Champion
Champion
Jump to solution

Two thoughts:

1) Did you run a chkdsk on the guest OS? You may have a bunch of lost clusters out there.

2) You could try creating a new VMDK, then using a clone program to clone the OS, then edit the VMX file to point to the new clone. That should 'force it' to resize.

View solution in original post

Reply
0 Kudos
7 Replies
rcardona2k
Immortal
Immortal
Jump to solution

Zeroing free space is not enough you need to coalesce the allocated blocks to the top of virtual disk. Try running defrag c: on the command line until it returns no further work necessary, then zero out blocks, then shrink.

mudaltsov
Expert
Expert
Jump to solution

How much free space do you have on the Mac? Also, are you using any disk encryption in the VM by any chance?

The shrinking operation normally makes a complete copy of the non-zero blocks in the virtual disk, to ensure data consistency in case something stops the process. If there's not enough space, the copy may fail and the whole shrink process would have no effect. With a monolithic (not split) disk, the entire disk may have to be copied in the worst case (if there are few zero blocks). With split disks, each 2 GB segment goes through the shrink process individually, so only 2 GB of free space is needed.

As rcardona2k pointed out, fragmentation could affect shrinking as well. Sparse VMDK files use 64 KB blocks, so if the guest file system is heavily fragmented, then there would be very few 64K blocks that are completely zero, and they would not be able to be removed. Although with 25 GB free, I would expect at least a few gigabytes to be removed.

chrisbateman
Contributor
Contributor
Jump to solution

Thanks for the replies. I had already tried defrag (from the UI, also from command-line although I wouldn't expect any difference) and then zero-ing and then shrinking - no change to vmdk size.

I am using FileVault, and I didn't have enough free space (got an error message), so I moved the VM to an external disk with >80GB free space - so this rules out free space and file vault issues.

I'm still stuck with a vmdk that won't shrink (by 25GB)... any other suggestions?

Thanks

Chris

Reply
0 Kudos
ColoradoMarmot
Champion
Champion
Jump to solution

Two thoughts:

1) Did you run a chkdsk on the guest OS? You may have a bunch of lost clusters out there.

2) You could try creating a new VMDK, then using a clone program to clone the OS, then edit the VMX file to point to the new clone. That should 'force it' to resize.

Reply
0 Kudos
mudaltsov
Expert
Expert
Jump to solution

It sounds like there should be no reason why shrink wouldn't work...

Could you post the .tgz file produced by going to Fusion menu Help -> Collect Support Information? It should provide some useful information for troubleshooting the problem.

Reply
0 Kudos
chrisbateman
Contributor
Contributor
Jump to solution

Thanks again for the replies, and sorry for my slow response (almost gave up on this). I had run a chkdsk, and I tend to think that I've exhausted options to get the VMware shrink process to work.

But the disk cloning idea was a good one... I used Clonezilla live in a temporary VM, attached the problem vmdk to it and a new, empty vmdk and got Clonezilla to do a disk-to-disk clone. Result: 25GB disk space won back!

Thanks for the help.

Chris

Reply
0 Kudos
ColoradoMarmot
Champion
Champion
Jump to solution

Smiley Happy you're welcome! As it grows, it'd be interesting to see if the new one will shrink properly.

Reply
0 Kudos