How to find out whether vmdk, vhd VM’s slowdown due to fragmentation on Windows?
I ran into this issue a couple of days ago on my windows and unix host machines running vmware workstation: namely the vm was responding really slowly. On windows XP (and beyond as I understand) there is defrag utility (accessories->system tools). I ran it with the analyze option

XP Defrag Utility
It produced the following report:

XP Defrag Report
Which showed that my VM had 263 fragments!!!
My next thought was whether I could find a script to run this periodically …. I could only find scripts to run defrag from the command line which produces output (below) but no information on specific files. I am in search of something like filefrag for ext* which can tell me fragment info just for one file.
C:\>defrag -a -v c:\
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
Analysis Report
Volume size = 74.46 GB
Cluster size = 4 KB
Used space = 70.85 GB
Free space = 3.61 GB
Percent free space = 4 %
Volume fragmentation
Total fragmentation = 22 %
File fragmentation = 42 %
Free space fragmentation = 3 %
File fragmentation
Total files = 362,428
Average file size = 305 KB
Total fragmented files = 11,723
Total excess fragments = 36,590
Average fragments per file = 1.10
Pagefile fragmentation
Pagefile size = 2.00 GB
Total fragments = 1
Folder fragmentation
Total folders = 83,631
Fragmented folders = 2,269
Excess folder fragments = 7,870
Master File Table (MFT) fragmentation
Total MFT size = 437 MB
MFT record count = 446,433
Percent MFT in use = 99
Total MFT fragments = 3
You should defragment this volume.
Look for a windows application called Whitney defrag. It’s a command line utility that will actually allow you to defrag an individual file rather than the whole volume. Obviously you need continuous free space on the volume for your VMDK to move to.
Rik
January 21, 2009 at 6:03 am
http://technet.microsoft.com/de-de/sysinternals/bb897428.aspx
Bernd Eckenfels
January 25, 2009 at 2:45 pm