Another useful Sysinternals tool


A utility that I’ve just recently started to use a lot is the Contig tool from Sysinternals. What it does is check one or more files for fragmentation and then attempts to move the file to an area on your hard drive where the whole file can live contiguously (is that really a word?) on your disk – in other words the whole file is in one piece with no fragmentation.

The utility is really simple to use:

    contig [-v] [-a] [-s] [-q] [existing file]
or  contig [-v] -n [new file] [new file length]

  -v: Verbose
  -a: Analyze fragmentation
  -q: Quiet mode
  -s: Recurse subdirectories

The best use of this utility comes from when you’re working with virtual machines on your computer. The virtual disk drive files grow to be very large and if you use dynamically expanding disks then they are prone to getting very fragmented very quickly. This obviously degrades disk performance – especially on slower drives such as in laptops. The fix for this is to run the Contig command which moves the file into a contiguous part of the hard drive like so:

contig -v c:\virtual-hard-drive.vhd

You can also use Contig to defragment a whole folder (or even the whole disk drive) by using the “-s” option which performs a recursive defragmentation on all files in all of the subfolders:

contig -v -s c:\virtual-machines\

You can get more information about Contig at the Sysinternals site, and check out some of their other utilities like the wonderful PStools, the old favourites Filemon, Regmon, and Process Explorer (and yes, I prefer these three individual tools to the combined Process Monitor utility.)

UPDATE: I just noticed a new download from the Sysinternals website, and that is all of their trouble shooting tools bundled into one zipped download called the “Sysinternals Suite

Leave a Reply

Your email address will not be published. Required fields are marked *