MetaChat REGISTER   ||   LOGIN   ||   IMAGES ARE OFF   ||   RECENT COMMENTS




artphoto by splunge
artphoto by TheophileEscargot
artphoto by Kronos_to_Earth
artphoto by ethylene

Home

About

Search

Archives

Mecha Wiki

Metachat Eye

Emcee

IRC Channels

IRC FAQ


 RSS


Comment Feed:

RSS

23 September 2007

AskMeCha: Why does Disk Defrag consume hard drive space?[More:]
I did a lot of cleaning up and managed to turn my 8 gigs of free hd space into 20, and now Disk Defrag is eating up my hard earned gigs! What gives? Bonus points if you use laymen's terms and/or simple analogies in your explanation.

(The way I always imagined it is that it's a lot like cleaning up my desk. I put all my journalism class stuff in one area, all my anthro stuff in another area, etc, and that way I don't have to go searching around for them in the morning which takes longer. The reason this whole thing confuses me is because it'd be like every time I organize my desk, it shrinks by a couple inches.)
It shouldn't. In mid-pass, DD is maintaining copies of your FAT tables, or, if your on NTFS, your MFT, and it is building some work indexes of file locations, etc., but if you let it run to completion, and you haven't done things that otherwise call for compressed files to be decompressed, you should actually get a little bit more space after a defragmentation, as clusters will, on average, be more fully utilized. DD bundled with Windows isn't super intelligent, however; if it's been awhile since you've defragmented, you may need to do 2 back to back passes, to fully consolidate your free space.
posted by paulsc 23 September | 19:24
Could this be related to file compression? Some versions of Windows will compress files that are not accessed for x amount of time - would defrag remove the flag to compress the files based on access date, thereby potentially expanding all sorts of crap you haven't accessed for a long time?
posted by dg 23 September | 19:43
What DD is doing is a lot more like emptying all the stuff off the top of your desk, deciding what would best optimize the space available, and then putting the stuff back.

Here's my metaphor:

Picture your disk drive as a big tile floor. Each tile is 14" x 14" square, and 3" thick. Your information is stacked on top of these tiles. Some stuff will take up a full tile almost completely, with no slack: this saves you space. Some stuff only takes up 2"x 2", now you are losing space. And some stuff can be mixed in with other stuff in a tile, other stuff can't.

When you save a file, it goes in a tile, and when you delete a file, the tile gets cleared out.
The cleared out space is made available for the next thing to be put in a tile (Your PC doesn't care where the tile is, it just needs to know where to put stuff, so it starts with the oldest "free" tile, fills it, and moves to the next). So, none of the other data in the other tiles is rearranged to make it easier to retrieve anything from this big tile floor.

Now picture that there are 4 or 5 layers of tile floors, and that the floors are a thousand tiles wide and 500 tiles long. A manuscript of a thousand pages might take up 40-50 tiles, and those are located anywhere at all in this "building" called a hard drive. Someone retrieving that manuscript has some walking to do.

What DD is doing is taking up huge swaths of this tile floor, clearing all the stuff in them to an empty spot elsewhere on the same floor, and then putting every thing back down again, only in order. When the retrieval happens, the data can be read tile-by-tile in order.

Shrinking that down to a disk drive size, the tiles are sectors and the layers are disk platters.

In general, disk defrag isn't meant to give you more disk space. It's simply a method to optimize how the space is used and thereby improve disk access speed. It's important to run it regularly, but for speed reasons, not disk space reasons.

And dg: Yes, disk compression affects defrag, but in a different way: When you create a compressed file, Windows takes the original file and compresses it, then deletes the original. This has the effect of "optimizing" each file for storage space. However, opening and closing compressed files is a lot slower than opening uncompressed files - because Windows has to uncompress and recreate the uncompressed file before you can access it.

I sure am using my words today!
posted by disclaimer 23 September | 20:21
PS: PaulSC's term - clusters - is a better equivalent to "tiles" than my word - "sectors".
posted by disclaimer 23 September | 20:25
Why does Disk Defrag consume hard drive space?

It does not. What is bringing you to the conclusion that it is?

What is probably happening is that Windows is expanding its swap file into the newly-cleared open space, so that you get faster response on the programs you have open. Also, other programs may immediately start using temp space as it opens up. Firefox in particular is a known memory hog.

I seriously doubt that Defrag is doing anything to take away space.
posted by stilicho 24 September | 01:26
Mecha Carnivores: || Weekend in PDX!!

HOME  ||   REGISTER  ||   LOGIN