Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know Windows file systems are very sensitive to fragmentation and Unix such as UFS, ZFS, ext3, or ext4 are not as sensitive.

But, is there any reason to defragment these filesystems at all?

If so, what tools are available for that ?

share|improve this question
Most mornern file systems in general do not need to be manually defragmented. This includes ext3, NTFS, UFS and others. – Chris S Feb 22 '10 at 21:23
Chris, I can't comment on others but NTFS most certainly does benefit from defrag. It greatly reduces the head thrashing caused by fragmentation and improves response times as a result. – John Gardeniers Feb 22 '10 at 22:41
@JohnGardeniers Every FS that support fragmentation will benefit from being defragmented. But, it's not necessary and the performance degradation due to fragmentation is limited compared to older file systems. – Chris S Nov 13 '11 at 19:37
up vote 15 down vote accepted

Quoting Wikipedia's page about the Ext3 Filesystem

Modern Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together, even if they can't be stored in consecutive sectors. Some filesystems, like ext3, effectively allocate the free block that is nearest to other blocks in a file. Therefore it is not necessary to worry about fragmentation in a Linux system

share|improve this answer
Fragmentation adds up though.. I'm trying shake, as suggested by Gert below. – blueyed Feb 19 '10 at 1:36

Actually, NTFS is not that sensitive to fragmentation. NTFS is significantly better than FAT32 -- in every way -- and is a fully modern filesystem.

I've been running Linux at home since 1996 and have never defragmented any filesystem. I have never had the need. The most I have done in this direction was pay attention to the kind of files I will be putting on a filesystem and using appropriate options when I mkfs. For example, if a filesystem will primarily contain large files, I'll use a larger block size. If I am making a huge file system but I know it will never have more than 1,000,000 files, then I'll use the -N 1000000 option to limit the number of inodes. In general, I'll tune the filesystem at creation to its task if a particular kind of file will inhabit it.

share|improve this answer

You don't need to defrag no. But if you still want to do it, you can always use shake.

share|improve this answer

While ext2 and ext3 do not provide for it (and generally need it less as they keep files relatively together in the first place) ext4 does provide for defrag. This article talks about the e4defrag program. But ext4 is a new filesystem.

However, compared to windows linux file systems are much better at not fragmenting, so I wouldn't worry about it.

share|improve this answer
ext2 and ext3 can be defragmented. They just don't need it in normal circumstances. – Eddie Apr 30 '09 at 15:35
bear in mind Windows FS never needed to be defragged either - NT3.51 used to allocate space either side of blocks just like ext3 does, but then MS scrapped that in NT4 for some reason. – gbjbaanb Aug 4 '09 at 15:24, but I wouldn't bother

share|improve this answer

The only good reason for defragging linux filesystem is to shrink virtual hard disks that have bloated.

Zero fill unused space, defrag and then compact the virtual disk from the VM manager.

share|improve this answer

You can defrag XFS file system (using xfs_fsr [dev|file]) and btrfs (using btrfs filesystem defragment [file]

As for all others, just make sure you have at least 80% free or few dozen gigabytes (whichever is smaller) and you shouldn't worry about defragmentation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.