Ubuntu – What doesn’t need defragmentation? Linux or the ext2 ext3 FS

filesystemslinuxmaintenanceUbuntu

Why don't you have to defrag a Linux system? Because it's using the ext2/ext3 file system, or because it's Linux?

That's relevant, for I have a double boot system (W7 / Ubuntu) and a common partition (NTFS) that can be accessed by both system. If I'm using this partition with Linux, will it get fragmented?

Another issue are the Truecrypt containers. I also access them with Linux and Windows, and they are FAT32. Do they get fragmented by Linux operating on them?

Best Answer

Here's an article on How To Geek about how ext2/ext3 allocates files on the disk. And they also have an article asking "Do you really need to defrag?"


On why FAT becomes fragmented:

"When you save a file to a FAT file system, [the file is saved] as close to the start of the disk as possible. When you save a second file, [the file is saved] right after the first file – and so on. When the original files grow in size, they will always become fragmented. There’s no nearby room for them to grow into."
-How To Geek

And wikipedia has more information about FAT fragmentation.

On how EXT2,3,4 allocate files:

"ext2, ext3, and ext4 file systems [...] allocates files in a more intelligent way. Instead of placing multiple files near each other on the hard disk, Linux file systems scatter different files all over the disk, leaving a large amount of free space between them."
-How To Geek

(And more info on defragmentation on ext3, from wikipedia)

"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."
-TLDP