Database Defragmentation – Poor Man’s Solution

November 29, 2008 – 3:25 pm

You might already have heard of Defrag.NSF. Defrag.NSF. is a database-oriented utility that allows you to target Domino databases for defragmentation. You can automatically monitor and pre-allocate contiguous free space to be added to your databases during Defrag.NSF. maintenance, giving them headroom to grow without scattering data to random sectors of your disks.

Why is defragmentation of Notes databases important? To answer the question read Adam Osborne’s article:  Busting the Myth – how Compact -C fragments databases.

I’ve tested Defrag.NSF. during the beta phase of the product. It is a great tool, reliable and easy to use. So far , so good. But good tools cost money. And even $199 for a single server copy can be a lot if you do not have any budget.

As a developer, I could write my own solution, or find something in the World Wide Web. There are quite a lot of freeware tools ( even OpenSource ) available, but 99% of them can only defragment a whole disk but not a single file. The only tool I’ve found so far to defragment a single file or a set of files is Contig.exe by Mark Russinovich.

Contig.exe works on NT 4.0 and higher. Contig.exe can be used to defrag an existing file, or to create a new file of a specified size and name, optimizing its placement on disk. Contig.exe uses standard Windows defragmentation APIs so it won’t cause disk corruption, even if you terminate it while its running.

Just download and copy contig to your Windows directory and you are ready to analyse and defragment your databases. I’ve also tried to copy the executable to the Domino executable directory and trigger it by typing

load contig.exe -a -v -s d:\IBM\Lotus\Domino\data\*.nsf

Contig works and prints the results of the analysis to the Domino console. But unfortunately it seems that it has some side effect on running server tasks. At least the traveler task on my Domino 8.0.1 terminated abnormally.

Here are a few screenshots to show, how Contig works and that it can make files contiguous after being fragmented when using the -c option with ncompact.

Before running compact -c , my mailfile is not fragmented

Then I ran compact …

After the task has finished, contig -a -v showed 111 fragments …

Running contig -v moved the fragments to a free disk block and makes the file contiguous.

Well, this is my poor man’s solution. It is ok, if you only have a handful of databases on your server ( or you do not have a budget to buy a tool like Defrag.NSF ).

  1. 5 Responses to “Database Defragmentation – Poor Man’s Solution”

  2. defraggler is also free and can defrag only certain files. No idea if there is a commandline for it.

    unfortunatelly nothing for linux yet 🙁

    By Jan Schulz on Nov 29, 2008

  3. Sysinternals tools are great! I didn’t know about this one but will have to try it. Thanks!

    By Tim Lorge on Nov 29, 2008

  4. Hi

    Take a look a JKDefrag. It the most advanced free fragmenter for MS Windows, I think. It is open source and works great. For all defragmenters for Windows it goes, they can not write to disk directly but must use the Windows API for it. So it is a matter of who does this in a smartest way.

    Brgds Jesper Kiaer

    By Jesper Kiaer on Dec 1, 2008

  5. @Jesper: Yes, I’ve tried JKDefrag, too. But there is no documentation of how to use the DLL in Visual Basic or LS ( no problem with Delphi and C ). I tried several hours but could not figure out, how to Declare the function calls. My client crashed constantly and finally I gave up …

    By Ulrich Krause on Dec 1, 2008

  6. Hi,
    I discovered “contig.exe” a week ago and have trialled it on NT4.0 R50x Domino servers thru to Windows 2003 R85x servers and from all my testing it’s a solid little tool that doesn’t bother Domino a bit.

    I’ve gone one step further and put it into a server task on OpenNTF http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/DominoDefrag

    Perhaps a free alternative…

    By Andrew Luder on Apr 13, 2009

Sorry, comments for this entry are closed at this time.