11

Possible Duplicate:
Why is defragmentation unnecessary?

I've been told that EXT file systems don't need to be defreagged because of the way they handle writes. Is this true? Would I benefit from a defrag every now and then? If so, what tools are best?

Jeremy
  • 2,846

2 Answers2

12

The linux kernel and linux filesystems do a lot of things to minimize fragmentation, but it's not true that fragmentation isn't possible. The amount of fragmentation is dependent on the type of usage of a filesystem (as Jeremy points to the Transmission bugtracker, large torrents can be an example of "bad" behaviour for fragmentation, depending on how applications work with them). In general, it doesn't get really bad normally, unless you manage to almost fill up your disk.

Oh, and you get the best defragmentation by copying everything to another filesystem, deleting the old filesystem, and then copying everything back. That's also true on Windows... ;)

Actually, you can do the copy + delete trick on the same filesystem too, but remember that you need to make a copy, then delete the old one, and not do a move/rename!

JanC
  • 19,422
-1

The ext3 and ext4 filesystem do not need to be defragged, since they defragment themselves. You can read this for more information: http://en.wikipedia.org/wiki/Ext3#Disadvantages (if it's necessary)

estevez
  • 74
  • Here http://en.wikipedia.org/wiki/Ext3#Disadvantages – estevez Oct 25 '10 at 06:19
  • 6
    But how about: https://trac.transmissionbt.com/ticket/849 ? Quote: The default Ubuntu filesystem ("ext3") will fragment large (>1GB), slowly-growing files (<1MB/s) . Such files include torrents or huge downloads. – Jeremy Oct 25 '10 at 06:23
  • 2
    It is a file system feature. It specially fragments them. I don't know what for. – estevez Oct 25 '10 at 06:27
  • Cool, thanks for the info, I'll accept it if no other answers come through soon. – Jeremy Oct 25 '10 at 06:37
  • 3
    It's a tradeoff, you have to sacrifice fragmentation on some files so you can improve fragmentation for others :) – badp Oct 25 '10 at 07:24
  • 7
    This answer seems completely wrong. Even the link given disagrees with it, saying that ext3 lacks a defragmenter. Ext3/4 do not defragment themselves. They are good at avoiding fragmentation though. @redlaber, fragmenting ( of torrents or otherwise ) is NOT a feature. – psusi Apr 08 '11 at 19:03
  • @psusi is right on. –  Aug 22 '12 at 21:15
  • one can explicitly defrag and ext4 filesystem with e4defrag – phuclv Jan 30 '17 at 04:33