Monday, November 12, 2007

File De-Fragmentation on the cheap

File De-Fragmentation on the cheap


This weekend I happen to be sitting in a location where I really could not go anywhere, I had to stay put for about an hour. This gave me an opportunity to pull out my November issue of TechNet Magazine. As I turned the pages, I found an excellent article that was quite timely since I have been dealing with some of these very issues at work this week. It had to do with file fragmentation, and how to de-fragment them. The article by Wes Miller was very good and covered some of the why(s) and how(s) of why files fragment. Also, some of the myths about it also; so I am not going to tell you what he said, it is his article. What I am going to cover is some of the utilities that he mentioned in the article. Very, very good stuff.

First, let me just cover the issues that I have been dealing with at work. One, we have been using Diskeeper from Executive Software. An excellent third party utility for the Enterprise level De-Fragmentation of Disks. Diskeeper allows scheduling, and boot time de-fragmentation which is very needed not only on workstations but on Servers. Yet what about for home, or for doing just one machine for whatever reason, or even if you use Diskeeper you my not want to spend that kind of money? The last part leads me to the second issue at work, some laptops just come in and need to be tuned quickly because Diskeeper has not run or had time to run, or the user just disabled it thinking it was slowing his machine down. For quickly trouble shooting and tuning, the last two utilities mentioned below come in very handy.

The three utilities I want to cover, are:

  1. The built in de-fragmenter in Windows, which is a scaled down version of Diskeeper
  2. PageDefra.exe
  3. Contig.exe

The built-in utility for file and folder de-fragmentation that now comes with XP has an advantage over the past ones, you can schedule it. This is one of the features of full blown Diskeeper; but with XP you have to use Task Scheduler, and you don't have all the bells and whistles. That is ok, just being able to automate when it runs is a real plus.

The other piece of fragmentation that you really can't do with the default utility that you can do with full blown Diskeeper is de-fragment the page file and the registry which can become very fragmented. The reason you can't do so is because these type of files are usually locked. To so so, you have to do it at boot time. This is where you can use the free utility from Sysinternals: PageDefrag. You can set PageDefrag to run once at boot up, or every time at boot up.

Also, sometimes, you may want to just de-fragment one file or one folder, for this enter Contig.exe, another free utility. You run this utility from the command prompt, but you can also script it and subsequently you can also schedule it. If you use these three utilities together, you will, in my opinion keep your disk and files in top notch shape.

System File De-fragmenter

I found this utility pretty straight forward. I can run it at the "next reboot" or at "every reboot". It consist of an exe and help file. Create a folder, put the files in there and create a shortcut to it. Run it, set the options, click Ok, and at the next reboot it will de-fragment the pagefile, the registry, and all the locked system files.


Contig

I found Contig really cool because you can run it from the command line, or create a batch file and schedule it. Also, you can defrag just one file or one folder or an entire drive. It is up to you. You can also use it to create a new file that is contiguous. You can also run it in verbose or quite mode, and with the -a, you can just get information on any file/folder.










Running defrag.exe as a scheduled task

The third piece of the puzzle is the defrag.exe. This is the utility that comes with Windows to de-fragment your hard drive. It is a pain manually ruining it. Usually it stops you from doing anything else, or at least it is a bother remembering to run it; but if you schedule it, you can forget about it. See screen shots below, and if you like, this Microsoft article.












With these three utilities and 0 dollars, you can keep your disk healthy and strong just as if you would of spent some money on a fancy de-fragmenter. I think that Diskeeper is a fine product, and it is very handy to deploy via a console in the Enterprise. It also does some real fancy things like "smart scheduling" and MFT padding just to name a few; but if you are just a single user or are just cheap, try these methods and utilities.

Delco

2 comments:

Anonymous said...

I think the biggest myth is that a fragmented drive has no adverse effect on performance. Perhaps it may seem true for initial levels of fragmentation and on PCs which do not engage in disk intensive activites. A severely cluttered drive does increase file access time and slow things down, irritatingly so.

Donn Edwards said...

The utilities you mention are most useful, especially when combined with a GPL freeware package called JkDefrag. I have bundled them together in an easy to install package.

JkDefrag is also one of the winners of "The Great Defrag Shootout" and it works much better than Diskeeper 2007 or 2008.