Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using VMplayer on Windows 7 and 2008 R2. Inside the guest OS, in VMware tools, there is a "Prepare to shrink" option on the "Shrink" tab. In the host VMplayer menu there is "Defragment" and "Compact" options (available when the VM is shut down). VMplayer documentation says you should also defragment using an OS based defragment tool within the guest and outside the VM in the host. That leaves five operations:

  1. defragment within the VM using OS defragmenter.
  2. shrink within the VM using VMtools
  3. defragment outside the VM in the host using OS defragmenter
  4. defragment in the host using VMplayer settings menu.
  5. compact in the host using VMplayer settings menu.

My question is this. Which of these operations are required and in exactly what order should they be performed?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

First, please realize you don't have to do this maintenance very frequently. If you want to go through the full list, here's the order and rationale.

  1. Defragment within the VM (if the machine is thin-provisioned, defragmenting later will expand the .vmdk as blocks are moved)
  2. Shrink the disks within the VM (this writes zeroes to unused sectors so the host can recognize which blocks are unused). This will temporarily increase the VMDK size to the configured size of the virtual disk. Then power off the VM.
  3. Defragment the disks from within VMware Player. This will move the blocks in the VMDK from their chaotic state (due to growth/use) and order them by actual block number.
  4. Compact the disks from within VMware Player. Since the empty blocks are zeroed, VMware can remove those blocks from the VMDK and reclaim space on the host.
  5. Defragment the host system to reorder all host files (including the VMDK) and remove fragments.
share|improve this answer
    
Somehow it is not working for me. I'm using VMware Player 6.0.1 and have Windows 7 virtual machine. While guest OS reports 5GB of 20GB free the size of virtual hard drive is still 20GB in host OS even after all steps above. What could it be? –  Mikhail Dec 25 '13 at 11:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.