Why is defragmenting unnecessary in Ubuntu?
-
3It is not unnecessary, and depending on your use, you may want to defrag every once in a while. XFS/ext4 are both simple to defrag. Just use the tools for them, they will be done in no time. EXT4 (Ubuntu default - ext4.wiki.kernel.org/index.php/…)– ApacheMay 12, 2014 at 15:37
5 Answers
The underlying filesystems used by Ubuntu, like ext2 and ext3, simply don't need defragmenting because they don't fragment files in the same way as NTFS. There are more details at ext3 - Wikipedia, the free encyclopedia
-
4
-
20
-
52-1. Actually, they might very well need defragmentation, just to a much lesser degree.– andolAug 5, 2010 at 19:06
-
3
-
4@andol, having some fragmentation does not mean you need to defrag. Windows "needs" it because it creates ridiculous levels of fragmentation. A small amount doesn't make any real difference, and Linux is very good at keeping it to an absolute minimum.– psusiNov 18, 2013 at 2:23
Some argue that it's actually a myth that we don't need defragmentation. It's argued that we do in fact need it, but only once the filesystem gets pretty full (i.e. less than ~10% free space). Tools are available for defragging such as e2defrag.
-
17And those "some" are correct. It's not possible to not-fragment if there's just plain nowhere else left to write.– macoAug 14, 2010 at 3:41
-
2Well one could argue that when you have less than 10% free space defragging for more free space isn't going to be your biggest problem and that a new hard disc could be wiser decision ;-)– RinzwindMay 10, 2011 at 9:44
-
7Watch out! Taken from this website:en.wikipedia.org/wiki/Ext3#Defragmentation " There is no online ext3 defragmentation tool that works on the filesystem level. An offline ext2 defragmenter, e2defrag, exists but requires that the ext3 filesystem be converted back to ext2 first. But depending on the feature bits turned on in the filesystem, e2defrag may destroy data; it does not know how to treat many of the newer ext3 features."– CelsoJan 22, 2012 at 17:34
-
7
Fragmentation is the product of writing files in the first available open blocks on a drive. Over time, as files get created and deleted, small sections of disk open up, which causes newly written files to be split over several such openings. This can reduce performance, although it was much more of a problem in the past with slow hardware and slow disks.
The default filesystem in Ubuntu, ext4 (and until recently, ext3) are designed to limit fragmentation of files as far as possible. When writing files, it tries to keep the blocks used sequential or close together. This renders defragmentation effectively unnecessary.
-
1
See this link. It gives quite a detailed explanation of how files are stored in Windows and in Linux, and why Linux filesystems usually do not need to be defragmented.
-
3A link only answer isn't very useful if the link broke, please add a sum up of the article.– PhoneixSJan 8, 2020 at 11:54
-
1
-
1Links seems to be broken, here is an archived version: web.archive.org/web/20160711220346/http://…– DerkadesOct 29, 2021 at 13:28
Ext4 Howto - Ext4 According to this article ext4 defragments on the fly but they are working on a defrag tool. I personally don't think it is needed except maybe for file servers that get heavy use.