Q. How can I defragment a virtual disk with VMware Workstation?

A. My last question showed you the nifty vmware-mount tool that comes with the VMware Disk Development Kit. But what if you're looking for .VMDK file defragmentation?

If you feel like fragmentation is costing you some performance, a tool that's already built into VMware Workstation that can complete the job. VMware's Virtual Disk Manager command line, vmware-vdiskmanager, is a command line tool that's used for a variety of different disk management tasks. It can defragment, create, rename, resize, and check the consistency of disk files. To defragment a virtual disk, navigate to C:\Program Files (x86)\VMware\VMware Workstation and run the command

vmware-vdiskmanager -d \\{pathToVMDKFile\\}

Remember that defragmentation from outside the virtual machine (VM) isn't the same as defragmentation inside the VM. VMware recommends that you use a disk defragmenter inside the VM first. In the case of Windows, this can be the built-in defragmentation service.

Once that defragmenter has completed its job, power down the VM and run vmware-vdiskmanager (or click Hard Disk, Utilities, Defragment inside the VMware Workstation UI). If you want the best performance, follow up with a third pass on the host itself, defragging its drive as a final step.

Obviously, defragmentation isn't the only useful administrative activity you'll get out of vmware-vdiskmanager. Get the syntax for all its capabilities here.

Catch up with @ConcentratdGreg on Twitter!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.