Why Linux does not need Defragmentation?

Regular defragmentation in a Windows PC speeds it up but if anyone of the Linux users have noted that there is no need of a defragmentation utility which come pre installed on your machine when you install a fresh copy and also you really don't need to install one on your machine while using Linux. Ever thought of why is it required in Windows and not in Linux?

To understand this first you need to understand what is fragmentation and why it occurs and how the two operating systems handle it differently.

What is fragmentation?

A hard disk is divided into various different sectors which contain small files and large files are spread over various different sectors which contain parts of the file. No person has a single file on hi system, heck even the Operating System is spread over a vast number of files. So when you update a file, say increase its size, the file system installed on the system tries to store this file next to the previous file's initial sectors but consider a scenario that the next sector is filled up, so the new part is stored in a sector which is not stored in a contiguous memory location. Hence when any software asks to read this file, the header of the hard disk must skip sectors while reading your file and hence reading chunks of file at a time slows down stuff.

So, now you can very well understand what defragmentation is, that is the process of moving around chunks of files to avoid the fragmentation as much as possible.

So because of the way the files are arranged in Windows (known as the file system, specifically NTFS or FAT in previous versions), they get fragmented over a time period and they need to be defragmented after some time to increase efficiency and speed.




Why not Linux?

ext2 and ext3 (file systems of Linux) allocates files to the hard disk in an intelligent way. Instead of placing files next to each other on the hard disk, they allocate them over largely scattered locations and hence there is a large amount of space in between them which can be leveraged when you edit your file. Even if fragmentation does occur, the file system manages it at run time itself and hence there is no need of any utility specifically for the purpose. Hence only when you fill the Linux system with huge amount of data, about 80%, you will start seeing some fragmentation.


0 comments:

Post a Comment