(Sometimes) You DO Need to Defragment Linux File Systems

I’m getting rather tired of the whole ‘article of faith’ from many Linux folk (both users and developers) who maintain that you don’t need to defragment Linux file systems. People have taken “there aren’t many times you do need to defragment” as “you never need to defragment”.

The Linux file systems are designed to minimise fragmentation.  They are much better at it than the Windows file system NTFS.  Linux file systems also seem to suffer less degradation in performance when they are fragmented, than NTFS does.

However, all file systems are compromises.  No-one has yet designed one that has great performance, assures you that your data has been 100% written to the disk in the event of an unexpected power-off or hardware fault, and doesn’t suffer defragmentation.

So under the right conditions, not only can even the newer Linux file systems become fragmented, but this fragmentation can impact performance. The conditions I’m most familiar with are having thousands of files that are being added to  randomly.  No matter how good the filesystem, you are either going to have to suffer performance hits, or it’s going to become fragmented over time.

Because of the ‘ancient wisdom’ of the ‘you never need to defragment’ concept, there aren’t any online defragmenters for the early file systems.  This means that defragmenting usually has to be done offline.  Time offline that some systems simply cannot afford.

Luckily,  those that understand filesystems have been coming around to the idea that you sometimes need to defragment, and are not only providing utilities to do this, but building ‘hooks’ into the filesystems themselves to allow it to be done safely.

XFS, EXT4 and BTRFS are those I know of that have defragment utilities of varying degrees and abilities.

So, can we please stop saying you never have to degragmnent a Linux filesystem?  Yes, it’s rare that most people will have to – but there are times it’s necessary.  And when it’s necessary it’s much better to have proper tools to do it, rather than having to take a system offline, or potentially damage your filesystem.

 

 

About Lisa

A Geeky Gamergrrl who obsesses about the strangest things.
This entry was posted in PC Topics and tagged , , , , . Bookmark the permalink.