APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Why defrag Windows XP and Vista Desktops?

© December 2008 Anthony Lawrence

People argue about whether you need to bother with defragging Linux and Mac OS X drives. Very few people even bother to argue about defragmentation of Windows machines. It's just a given - the machine is slow, defrag it. Case closed.

I've always been a little skeptical about defragging Windows desktops. Servers running databases or big apps, sure: defrag that puppy. But desktops? What's going to get fragmented on a typical user's XP or Vista desktop machine?

In user file space, there are really only two areas that the ordinary user is likely to have fragmentation that matters. One is Outlook PST files and the other is virus definition files.

Oh, sure, there are other places that get fragmented. The indexes for Temporary Internet Files, for example. Those get scattered about the disk, too. Do you care? Temporary Internet files are probably the first thing you clean up when your browser gets slow anyway, right? If you are going to delete these files, fragmentation is not an issue.

You might have some other large files of your own: big photos, a .zip file you downloaded.. are they slowing your system down? Of course not: maybe when you look at that photo it loads a little slower than it could, but so what? Are you looking at it daily? Nothing is trying to open that while you are doing your daily work, so that isn't slowing you down.

The zip file doesn't matter either - how often will you be unpacking it?

This is the point often missed in these arguments: If you aren't USING a file, fragmentation in it does not matter. The pretty defrag map may show lots of fragmentation, but if none of it is in files you are reading or writing, none of it affects you.

Here's another example: Windows Restore Point files are bound to be fragmented, but why would you care? You aren't likely to access them at all, but if you do, an extra second or two because of excess file seeks is the least of your concerns.

So we're back to those Oulook PST files and the virus files. Surely those matter?

With Outlook, you'd be far smarter to avoid large PST files anyway (and even smarter to avoid Outlook outright!). Either use IMAP or if you must put things in personal files, keep your Inbox and Deleted folders small. Make appropriate folders for things you want to keep and keep those folders lean and mean also. If you are so disorganized that you can't do that, at least move everything from Inbox once a month or once a quarter and just name the new folder "Inbox200812" or whatever makes sense to you. If you do just this (and don't use Deleted Items as a filing cabinet!) you'll likely eliminate any fragmentation that could happen here.

You can't control the virus definition files, of course. They are going to get updated, and they are going to fragment. Unfortunately, as new definitions get downloaded very frequently, it's likely that they will re-fragment very quickly after you clean them up. You aren't going to spend hours defragging your disk every time a new file comes down, right?

Another place with a similar problem is Windows Update. The patch files aren't quite as frequent as virus updates, but again they are likely to get fragmented quickly. What can you do? You aren't going to defrag the whole machine because of Windows updates, are you?

There is a single file defragger: Contig by By Mark Russinovich. This is a free download that you can use to target specific files rather than tying up your machine for hours running the disk defragmentation program. But even so, if the files will just re-fragment tomorrow, is this worth the effort?

Paging and Registry file fragmentation

Your Page and registry files can get fragmented. Unfortunately, these are off-limits to most defragmentation software. Mark Russinovich comes to the rescue again with PageDefrag, which runs as your system boots to reorder these files. But is there any point? I'm not convinced there is for your Page file(s). Your access to memory is very random, so what good can be accomplished by re-ordering things in swap? I just can't see that doing much of anything for you. As to the registry, I suppose if you are constantly adding and removing programs and you have a lot of them, your registry files might get big enough to benefit, but I bet it's rare to see more than one or two extents in any of them. No harm in running this once out of curiosity, but I can't see it as anything you'd use often.

Real world example

I just took a look at my wife's XP box. It's several years old and if it has ever been defragged, it was a long time ago. Here's what the analysis phase said it found:

Volume ACER (C:)
    Volume size                                = 25.25 GB
    Cluster size                               = 16 KB
    Used space                                 = 20.49 GB
    Free space                                 = 4.76 GB
    Percent free space                         = 18 %

Volume fragmentation
    Total fragmentation                        = 16 %
    File fragmentation                         = 30 %
    Free space fragmentation                   = 3 %

File fragmentation
    Total files                                = 63,417
    Average file size                          = 306 KB
    Total fragmented files                     = 3,712
    Total excess fragments                     = 17,943
    Average fragments per file                 = 1.28

Pagefile fragmentation
    Pagefile size                              = 756 MB
    Total fragments                            = 9

Folder fragmentation
    Total folders                              = 6,876
    Fragmented folders                         = 33
    Excess folder fragments                    = 118

Fragments       File Size       Most fragmented files
86              5 MB            \PHOTOS\2006\Roll 3\MOV00362.MPG
249             114 MB          \WINDOWS\Installer\508A391.MSP
215             7 MB            \WINDOWS\Installer\1A67BF3D.MSP
153             6 MB            \WINDOWS\$HF_MIG$\KB956390-IE7\SP2QFE\IEFRAME.DLL
145             11 MB           \Documents and Settings\All Users\Application Data\Symantec\LiveUpdate\Downloads\1195148577jtun_nav2k6enn01m25.m25.full.zip
274             5 MB            \Documents and Settings\LINDA\Local Settings\Temp\ATT1.eml-2.txt
193             384 MB          \Documents and Settings\LINDA\Local Settings\Temp\pft1A.tmp\QBooks\DATA1.CAB
122             10 MB           \Documents and Settings\LINDA\Desktop\All Pictures\Thumbs.db
102             2 MB            \Documents and Settings\LINDA\Desktop\All Pictures\P1010829.JPG
102             4 MB            \Program Files\Common Files\Symantec Shared\VirusDefs\20080712.002\TCSCAN7.DAT
267             8 MB            \Program Files\Common Files\Symantec Shared\VirusDefs\20080712.002\VIRSCAN5.DAT
315             25 MB           \System Volume Information\_restore{3B5EBD63-0BA3-4CB6-8D46-0666EE4E44F9}\RP351\SNAPSHOT\_REGISTRY_MACHINE_SOFTWARE
110             26 MB           \System Volume Information\_restore{3B5EBD63-0BA3-4CB6-8D46-0666EE4E44F9}\RP354\SNAPSHOT\_REGISTRY_MACHINE_SOFTWARE
185             26 MB           \System Volume Information\_restore{3B5EBD63-0BA3-4CB6-8D46-0666EE4E44F9}\RP356\SNAPSHOT\_REGISTRY_MACHINE_SOFTWARE

Pretty much what I'd expect, right? She doesn't use Outlook, so none of that junk appears. The only other thing in the list that would ever affect day to day operation are the Symantec A/V files. We know that those are going to re-fragment quickly.. is there really any reason to defrag this disk?

By the way, did you notice the Pagefile had 9 fragments? That was AFTER running PageDefrag, so it's easy to think there's not much to be gained there - it became fragmented again almost instantly!

I ran the defrag program - all the "restore" files ended up in the list of "Files that cannot be defragmented". As I noted above, that doesn't really matter, but another file unable to be defragged was a Quickbooks data file. Defragging didn't help us with that!

Now of course there will be exceptions. Maybe you run a large database on your desktop. Maybe you regularly download large files for other reasons and use them regularly. Adding new programs could introduce fragmentation (see Performance Check: How 200 New Programs Slow Down your PC).

You could have specific needs for defragmentation. Linda has that Quickbooks file, for example. But if you do, you probably know that already, right? For most people, housekeeping (cleaning up temporary files, keep PST files small) is likely to have far more effect than defragmentation.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Should you defrag your Windows Desktop? Why?


Inexpensive and informative Apple related e-books:

Take Control of IOS 11

iOS 8: A Take Control Crash Course

Take Control of Preview

Photos for Mac: A Take Control Crash Course

Digital Sharing Crash Course

More Articles by © Anthony Lawrence

Related Articles

Sat Dec 13 21:23:51 2008: 4927   bob4linux

In my Win98 days I put my swap file on its own small partition and gave it a max+min of 300 megs. Otherwise it just gets spread everywhere like a mad dog defecating. Win98 bless it inspired me to move to Linux and I thank MS for that.

Sat Dec 13 22:07:20 2008: 4928   TonyLawrence

We don't have much to thank them for, do we? :-)

Sat Dec 13 22:26:46 2008: 4929   jtimberman

I haven't run defrag on a Windows system since I started using Windows 2000 back in, uh, 2000. That includes several XP workstations/gaming systems, and four Vista systems.

It really isn't necessary as you say. It's also a ridiculous "troubleshooting" tactic used by helpdesks too. Once, I had cable modem connection issues and they asked me if I defragged my hard drive. I said yes to placate them, but they didn't know that all the systems on my network at the time ran Linux or Solaris, except the W2K gaming system, and it was being reinstalled at the time.

Sun Dec 14 03:39:08 2008: 4930   TonyLawrence

Yeah, the questions asked by first level support can be pretty annoying..

Sun Jan 4 20:51:24 2009: 5072   TonyLawrence

Whether or not you defrag, try to keep the noise down:



Printer Friendly Version

Related Articles

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Never let a computer know you're in a hurry. (Anonymous)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode