Fog Creek Software
g
Discussion Board




How does disk defragging work?

"Diskeeper has completed a defragmentation run on this volume and there remain 122 fragmented files and/or directories and 3413 excess fragments.  (There were 4863 excess fragments before the defragmentation run, and now there are 29% fewer.)"

Why?
Why wouldn't the program finish the job? How tough is it to defrag a drive that's not in use?

The other thing I don't understand is the requirement for 15% free space - I'd think you could defrag with five free clusters, never mind needing a GB of free space. Sure it'll take longer, but that should be a configuration option.

Can someone who knows the innards enlighten me on how this works?

Philo

Philo
Saturday, October 4, 2003

Isn't defragging like playing solitaire? You shuffle the pieces around until all the proper files line up. Think about Freecell... When you only have 1 open slot, it's not exactly easy to move one stack of cards to another stack where they should be. But when you have 4 or 5 open slots, it becomes much easier.

Mark T A W .com
Saturday, October 4, 2003

The operating system has locked files. They stay fragmented and force other files from defragmenting. It didn't happen back in the DOS days because no one was locking anything.

Li-fan Chen
Saturday, October 4, 2003

Li-fan, which see: "not in use"
It's a separate volume with NO files in use. And if I keep running defrag, each time it gets a few more fragments.

Philo

Philo
Saturday, October 4, 2003

Mark - Solitaire's different; it's got rules to make it hard.

Shuffle a deck of cards, lay them out, face up, one after another. Now, you have one open slot - can you sort the cards using the one empty spot?

Of course you can. It'll take a while, but you can do it. That's my point. With 15% free space it should be cake.

Philo

Philo
Saturday, October 4, 2003

Not helpful to your problem at hand, maybe, but I use the explicit defrag tool built into the OS, and it always results in a perfectly defragmented drive for drives that are not in use, and gets pretty darn close for the OS drive (which will always have locked files).

Maybe you should just use the built-in stuff?

Brad Wilson (dotnetguy.techieswithcats.com)
Saturday, October 4, 2003

>> "Not helpful to your problem at hand, maybe, but I use the explicit defrag tool built into the OS, and it always results in a perfectly defragmented drive for drives that are not in use, and gets pretty darn close for the OS drive (which will always have locked files)."

Not necessarily so.  This is simply what the program reports to you.  I could write a defrag program that doesn't do a darn thing but make the drive spin for 5 minutes then tell the user that I just defraged the whole thing.

Dialog boxes are lies.  I don't trust them.

abcde
Saturday, October 4, 2003

http://www.howstuffworks.com/question548.htm

Dave B.
Saturday, October 4, 2003

These links may answer your question better than the previous link I posted:

Why Diskeeper's algorithm isn't the best:

http://www.whitneyfamily.org/Hacks/?item=Defrag

Defrag source code and documentation:

http://www.sysinternals.com/ntw2k/info/defrag.shtml

Dave B.
Saturday, October 4, 2003

Another one: (Kinda old but still applies I think)

http://www.winntmag.com/Articles/Index.cfm?IssueID=20&ArticleID=304

Dave B.
Saturday, October 4, 2003

I have to ask "Does it matter?" Its always been my experience that de-fragging made no performance improvement so I never bother anymore. In which case why try to be so thorough? Or is it the case that I've always been using a lame (built-in) one and that's why I see no gain?

sgf
Sunday, October 5, 2003

I know that you *can* do it with just one empty slot, so to speak, but at some point you reach a point of diminishing returns where you're fragmenting other files in order to defrag others.

In other words, it is kind of like Freecell.. Why would you seperate the 10, 9, 8, 7, 6, 5, 4 row you have just to make room for something else.

In any case, this is all on a somewhat theoretical level, and from what I've gleaned from watching the dos DEFRAG tool in action on my old hard drives.

Mark T A W .com
Sunday, October 5, 2003

I generally only defrag when my hard drive gets really bad, and then I think about it because I notice the drive thrashing when I do anything. So I defrag the heck out of everything, and definitely notice an increase in responsiveness.

Philo

Philo
Sunday, October 5, 2003

I've used a number of different programs over the years but have generally preferred Norton Speed Disk.  With Windows XP I have noticed something similar to what Philo mentions in his original post -- Speed Disk runs for a while and then reports that it's done, but the on-screen display clearly shows that  there is still some fragmentation.  This is on drives that have lots of free space (for example 120 gig drive with 60-70 gig free).

Even more odd is something I noticed a couple of years ago --  disk defragmenters don't seem to work at all if you are  running an NT based OS (Windows 2000 or XP) and have a a FAT32 formatted hard-drive.  I tried Norton, Disk Keeper and the defragmenter that comes with Windows and got the same result every time - The program runs for a while and then reports that it's done, but the on-screen display clearly shows lots of fragmentation.

Maytag Repairman
Sunday, October 5, 2003

Thanks to Dve B for this link ( 
http://www.whitneyfamily.org/Hacks/?item=Defrag
  )  -- it explains why disk defragmenters don't work on FAT32 drives when running Windows 2000 / XP

"The operating system doesn't provide for defragmenting directories on FAT and FAT32 drives. While all your files will be as defragmented as possible, the immobility of directories totally throws a wrench in the process."

Maytag Repairman
Sunday, October 5, 2003

If you haven't already, you may want to try PerfectDisk by Raxco ( http://www.raxco.com/ ). Over the years, I've switched between Diskeeper and PerfectDisk depending on which one worked better on my systems in their current versions. I'm currently using PerfectDisk version 6, which has done a much better job (i.e. few or no remaining fragmented files) on my systems than Diskeeper 7. I haven't tried Diskeeper 8 yet.

Jack Johnson
Sunday, October 5, 2003

Diskeeper can be set to run defrag at boot-time, there are also options relating to defragmentation of the paging file, MFT, etc. Maybe some of those would have an effect?

Eponymous Biro
Sunday, October 5, 2003

i'm thinking about setting up a schedule for my disk defrag - is there any harm to doing this daily, weekly, etc?  can defragging too often hurt my hard drive?

nathan
Sunday, October 5, 2003

___"an defragging too often hurt my hard drive? "_---

Can driving your car too often affect its longevity?

The answer is yes. Now defragging a severely defragged drive will cut down on the amount of head travel involved (the equiavalent in kilometres for a car), so when you do frequent defrags you have to decide if the increased wear caused by the defrag operation is going to be made up for by the decreased seek times after the defrag.

My home machine is W2K and it advises me when defragging is needed. After three years it still says it is unecessary. But if you are permanently installling and uninstalling, then frequent defrags are a good idea.

Stephen Jones
Monday, October 6, 2003

*  Recent Topics

*  Fog Creek Home