Fragerizer – profile-guided load-order disk optimizer


One of the frustrations of using a project like Metasploit is waiting for it to load, which entails finding and loading up hundreds or thousands of small component files. Some of this comes from a slow Ruby implementation of loading new files, but much of it comes from the fact that these files are scattered in no particular order across the disk. Many of the delays are waiting for the disk to seek to the next object on disk, whether reading a directory or file. In fact, by my count, a full load of the Metasploit GUI with database entails accessing almost 10,000 objects on disk. Even if you defragment your hard drive, you still wait for the access time of the disk to seek and access each file.

It would be faster if each file and directory was laid out on disk in the order that it would be accessed to load more quickly. So I wrote fragerizer, a smallish utility to perform that arranging for you. And invented a new word:

Fragerize. v. To defragment and arrange files & directories sequentially on disk in order of use.

First you will have to use Process Monitor to record which files your program accesses and in which order it accesses them. Then hand that to fragerizer, and it will handle the rest. As an implementation disclaimer, it defragments and moves whole files, rather than trying to only move the accessed clusters. This is mostly because the programs I use, like MSF, generally read in entire files, and also because when a program reads part of a file, Windows will try to read-ahead, and will likely access clusters that the program didn't instruct it to. If I didn't have the whole file there, this will cause more seeking instead of preventing it. (Even if the file was opened random-access style, Windows will attempt to extrapolate what the next read will be based on the last two)

How to use:
0 Download and unzip fragerizer here: http://www.scriptjunkie.us/wp-content/uploads/2011/09/Fragerizer.zip
1 Download and start Process Monitor http://technet.microsoft.com/en-us/sysinternals/bb896645
2 Run whatever program you want to fragerize, or take whatever action you want fragerized
3 Once that has finished, in Process Monitor save all events as a CSV
4 Open a command prompt and run fragerizer.exe ProcmonOutputFile.csv C:\path\to\optimize where C:\path\to\optimize is the parent folder of the files/directories you want to fragerize. e.g. if you want to fragerize MS Word, you might put "C:\Program Files (x86)\Microsoft Office"

This uses the Windows defragging API's so it shouldn't fry any of your files. Unless your disk is bad. Or I made a big error. But either way, don't sue me. I don't have any money.

, , , , ,

Comments are closed.