Is it necessary to defrag drives in Ubuntu? If so, how do I do it and how often should it be done?
|
Defragment is (or was) recommended under Windows because it had a poor filesystem implementation. Simple techniques such as allocating blocks for files in groups rather than one by one keep fragmentation down under Linux. Typical Linux filesystems only gain significantly from defragmentation on a nearly-full filesystem or with unusual write patterns. Most users don't need it, though heavy file sharers could benefit from it (filling a file in little bits in the middle is not the case ext3 was optimized for; if you're concerned about fragmentation and your bittorrent or other file sharing client offers that option, tell it to preallocate all files before starting to download). At the moment, there is no production-ready defragmentation tool for the common filesystems on Linux (ext3 and ext4). If you installed Ubuntu 9.10 or newer, or converted an existing installation, you have an ext4 filesystem, which supports extents, further reducing fragmentation. For those cases where fragmentation does arise, an ext4 defragmentation tool is in the works, but it's not ready yet. Note that in general, the Linux philosophy and especially the Ubuntu philosophy is that common maintenance tasks should happen automatically without your needing to intervene. |
|||||||||||||||||
|
|
This is the best explanation (not only of file fragmentation but of how EXT2/3/4 is more resistant to it than FAT or NTFS) I have found and I still refer people to it: http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting |
|||
|
|
|
If you're using ext, here is a good quote from Theodore Ts'o (he was heavily involved in the development of the file system):
So really, the answer is 'no'. Only in extreme cases will you start to see adverse fragmentation (with ext). |
|||||
|
|