File System Fragmentation

All file systems suffer from fragmentation.

Let me rephrase that more clearly in case you didn’t quite get it the first time.

ALL FILE SYSTEMS SUFFER FROM FRAGMENTATION <PERIOD>.

It doesn’t matter what file system you use one your computer, if you delete and write files it will become fragmented over time.  Some older file systems (like say FAT and FAT32) had major performance issues as the file system began to fragment, more modern file systems do not suffer as much performance lose from fragmentation, but still suffer.

If you want to argue that your writable file system doesn’t fragment, you haven’t a clue what you’re talking about, so read up on how your file system really works and how block devices work to understand why you just can’t have a file system that doesn’t fragment files or free space or both.

What can you do about fragmentation?

Well, you might not really need to do anything, modern disk drives are fast; and on a computer that’s doing many things at once the fragmentation may not have much of any impact on your performance, but after awhile you’re probably going to want to defragment your files.

The act of copying a file will generally defragment it; most modern file systems will attempt to allocate contiguous space for a file if it can (files that grow over time cannot be allocated contiguous, but they can be defragmented at their current size).

On many operating systems you can actually get programs that are designed to defragment your file system.

How often should you defragment your file system?

Well, I generally recommend you do it right after installing and updating your computer; and then any time you make major changes (large software installation, large update, etc).  But that you not do it automatically or an a routine schedule — there’s not enough benefit to that.

You can also analyze your disk (again using software) to determine how fragmented it is… and then defragment when it reaches some point that you believe represents a performance decrease.

Also, try and keep your disk clean, delete your browser cache, temporary files, duplicate files, and clutter — the less “junk” you have on your disk, the less need there will be for defragmenting.

Originally posted 2009-01-05 12:00:03.