VMware Communities
picoli
Contributor
Contributor

vmware workstation 8 defrag

hi all,

http://www.vmware.com/support/ws55/doc/ws_disk_defrag.html

this document suggests that defrag be performed in three steps.

I can understand step 1 (defrag utility inside the virtual machine) and 3 (defrag utility on the host machine), and I also understand why one must follow the other.

what puzzles me is step 2 (defragment virtual disks from the virtual machine settings editor): what is this all about?

step 1 reorganizes files and folders in the guest OS, while step 3 does the same at the host level (and hence at the virtual disk image file level)... isn't this enough?

respectfully

- Lorenzo -

Tags (2)
0 Kudos
5 Replies
mfelker
Expert
Expert

step 2 (defragment virtual disks from the virtual machine settings edito

What this means (the wording could be more explict) is that you click on the virtual hard drive in VM settings under the VM tab. This will be able to edit the memory, processor etc).  Then the will be a dialog at the right of the screen that says :Advanced:   Click that and you will find a utilities button.  Click that and one of the options will be to defrag the hd hard disk (vmdk).  I may not be completely precise here because at the moment I don;t have a VM open (still working on the hsot OS).  Thkere may be a documentation link - I'm not expert in finding  this.

0 Kudos
picoli
Contributor
Contributor

Hello Martin, thank you for your answer. Maybe my question was unclear; what you wrote is absolutely correct but it isn't what I was looking for. I'm not concerned about "how to perform step 2" but rather "what's step 2 supposed to do and why is it necessary". I'm just wondering what's going on under the hood when I click that button.

0 Kudos
mfelker
Expert
Expert

Hi picoli:

        I've had the same question for well over a year and simiply haven't got an answer that I can understand.  What the post(s) were concerning  both the defrag and shrink processes are  pretty much identical/and or very difficult for me to understand (note tha I've said me!)  I would like an answer from somebody on whether it  is better to shrink a VM first and then defrag or vice versa. I followed the 3 steps you outlined and after "defragging" the vmdk there werr more unfragmented files on the physical HD than before (usinig defraggler which is an excellent for  free program - ultradefrag doesn't work on Windows 8 - don't use if you value your file structure).   As far as I'm concerned since I've yet to have somebody point me to a program that measures the disk  I/O before and after "defragging" I just use the step 2 version if VMwar esays I should us it - its never done damage unless maaybe you stop the process befor comp[letion.  As an added note the Vmware Tolls included with WS 9 are now command line only.  There is documentation from VMware oin these Tools (which include a defrag and shrink switch) - I posted it before but if anyibody wants it  you'll need to Google away.

0 Kudos
picoli
Contributor
Contributor

Hi all, I think I got it by myself. Here's what I came up with after careful consideration Smiley Happy:

1) Any modification to a file that requires its clusters (re)allocation could possibly lead to fragmentation. For this reason, the host level defrag must be the last operation.

2) Unless a virtual disk is pre-allocated, blocks are appended to it as they are requested by the guest OS. This inevitably leads to a "virtual disk fragmentation", in the sense that the disk's blocks are not contiguous (as in a physical disk), but randomly spread across the virtual disk's image file(s). VMware's defrag reorganizes the virtual disk's blocks inside the virtual disk's image file. It does not work at the guest OS's file system level (it should be aware of any file system format used by the guest), nor does it work at the host filesystem level (why should it? there are dozens of utilities that do that). In addition, any guest OS operation that involves allocation of new blocks could possibly lead to virtual disk fragmentation (both in the sense of "blocks inside the virtual disk's image file" and "virtual disk's image file's clusters on the host filesystem"). For this reason, both virtual disk defrag and host level defrag must come after the guest OS defrag.

3) The shrink operation frees up unused virtual disk blocks, releasing them to the host OS. This could lead to: (a) more virtual disk fragmentation, once the guest OS requires more blocks and (b) virtual disk's image file fragmentation. I couldn't determine if the shrink operation performs a virtual disk defrag operation too, but I guess no. But I noticed that the virtual disk defrag operation usually leaves larger virtual disk's image files. So: if one wants to perform both shrink and virtual disk defrag, I guess it's better to do defrag first and then shrink.

That said, my feeling is that defrag operations do not have a great impact on my virtual machines' performances. There must be a measurable difference, but I don't care about benchmarks. Moreover, any performance gain can't compensate the time required for a full defrag (at the three levels: guest, virtual disk, host). So, unless my virtual disks become really badly fragmented, I'll let them grow and care about something else Smiley Happy.

0 Kudos
mfelker
Expert
Expert

Sounds completly reasonable to me. Defrag operations also seem to use quite a bit of resources and make my host machine almost totally unresponsive - delaying other tasks.

0 Kudos