What is the reason that the Linux operating system does not need to be defragmented?

  

If you are a Linux user, you may have heard that you don't need to defrag your Linux files system
. You may also notice that the Linux distribution does not come with a disk defragmentation tool. Why is this? Want to know why in normal use, Linux files system
do not need to be defragmented, and Windows needs. You need to understand why fragmentation is generated, and Linux and Windows files are systems
, and how they work, respectively.

What is debris

Many Windows users, even without much experience, I believe they also periodically defragment, to speed up their computer. Why do you want to do this, many people don't know.

Simply put, each hard drive has many sectors, and each sector can contain small pieces of data. For particularly large files, they must be stored in many different sectors. Let's say, for example, some different files saved in the file System
, each of which will be stored in a contiguous sector. Later, you update the file you originally saved and increase the size of the file. The file System
will attempt to store the new portion of the file next to the original sector space. Unfortunately, if there is not enough contiguous space, the file must be split into multiple fragments — this is why the fragmentation is generated. When your hard disk reads a file, the head must skip the different physical locations on the hard disk to read the data for each sector — this is why it slows down.

Defragmentation is a centralized process of moving bit files to reduce fragmentation and ensuring that each file is contiguous on the drive.

Of course, different SSDs, which have no moving parts, should not be defragmented - SSD Disk Defragmenter to actually reduce its service life. Also, on the latest version of Windows, you don't need to worry about tidying up your files System
Shards - Windows will do it for you automatically.

How Windows System
works

Microsoft's old FAT file System
, the last time I saw the default in Windows 98 and ME, now Also used on a USB flash drive, it does not intelligently arrange files. When you save a file to a FAT file system
, it will save it as close as possible to the beginning of the disk. When you save the second file, it will be saved immediately after the first file, and so on. When the original file size grows and there is no free space nearby for them to grow, they always generate fragments.

Microsoft's new NTFS file System
, used on Windows XP and 2000, seems to be a bit smarter, it allocates more "bluffs" around the files on the hard disk. & rdquo; Free space. Although, any Windows user can tell you that over time, NTFS files will still generate fragmentation.

Because they use these files system
to work, they need to defragment to ensure their performance is not degraded. Microsoft's latest version of Windows can run defragmentation in the background to alleviate this problem.


Linux File System
how it works

Linux has ext2, ext3 and ext4 file System
, ext4 file System
Using Ubuntu and other current Linux distributions, it has a smarter way of distributing files instead of putting multiple files close to each other on the hard drive. Linux files systems
are scattered across different file disks and leave a lot of free space. When a file needs to be edited, there is usually enough free space. If the fragmentation does occur, the file system
will attempt to move the file to reduce fragmentation. Under normal use, no defragmentation tools are required.

If your files
system is full or 95% (even 80%), you just might start to see some debris. In short, the design of the file system can avoid the generation of fragments during normal use.

If you have fragmentation problems on Linux, you may need a larger hard drive. If you do need to tidy up the file system
, the easiest and most reliable method might be: copy all the files backed up from the partition, then erase all the files from the partition, then copy the files back to the partition . Such a file System
will intelligently copy the files to disk.

You can also use the fsck command to measure the fragmentation of Linux files system
- look for output "non-adjacent nodes".

Copyright © Windows knowledge All Rights Reserved