how to defragment linux file system?

Steve Lamb grey at dmiyu.org
Sat Mar 20 08:27:46 UTC 2010


NoOp wrote:
> A. It is not necessary to defrag an ext3 filesystem.

     It is *generally* not necessary to defrag an ext3 filesystem.  However 
that advice was written before the advent of the wide scale use of bittorrents 
which, with their incremental and random updating of files, throws a huge 
amount of fragmentation on the filesystem.  This isn't to say that torrents 
are the only issue.  Running an ext3 system with a low amount of free space 
will also cause a high amount of fragmentation over time.

     The answer really is that ext3, under normal operation, does not need 
defragmentation but for a fraction of a time FAT or even NTFS do.  It is 
normally not something the average user need concern themselves over and if 
there is ever a case of a file which might be highly fragmented (as in the 
case of a torrent) the solution is simple.  Ensure you have a decent amount of 
space (which means a high chance of continuous space) and simply copy (not 
move) the file then delete the original.  The copy operation will attempt to 
keep the file as unfragmented as possible.

     If anyone doubts the veracity of this advice consider the last 2 quoted 
lines from that page.

 > No true defragmenting tools exist for the ext3 file system, but tools
 > for defragmenting will be included with the ext4 file system.

     If ext3 didn't need defragging *ever* then why would the successor have a 
planned defragment tool?  ;)  Esp. in light of the use of extents over the 
traditional block map.

     Pedantic, I know, but I'm a stickler for accuracy.  :D

-- 
          Steve C. Lamb         | But who decides what they dream?
        PGP Key: 8B6E99C5       |   And dream I do...
-------------------------------+---------------------------------------------




More information about the ubuntu-users mailing list