Linux doesn't need defragmentation. There is a cause for

  


Computer Shop News If you are a Linux user, you may have heard that you don't need to defrag your Linux file 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, the Linux file system does not need to be defragmented, and Windows needs to. You need to understand why fragmentation is generated, and the two file systems, Linux and Windows, work together.

What is fragmentation? Many Windows users, even if they don't have much experience, I believe they will also defragment them regularly to speed up their computers. 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 stored 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, SSDs are different, they don't have moving parts, and they shouldn't be defragmented - defragmenting SSDs actually reduces their useful life. Also, on the latest version of Windows, you don't need to worry about defragmenting your filesystem - Windows will do it for you automatically. How does the Windows file system work? Microsoft's old FAT file system, the last time I saw the default on Windows 98 and ME, is now also used on a USB flash drive, it can't arrange files intelligently. When you save a file to the FAT file system, it saves 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, adding more "buffering" free space around the files on the hard drive. Although, any Windows user can tell you that over time, the NTFS file system will still generate fragmentation. Because of the work with these file systems, they need to be defragmented to ensure their performance is not degraded. Microsoft's latest version of Windows can run defragmentation in the background to alleviate this problem. How does the Linux file system work? Linux has ext2, ext3, and ext4 file systems. The ext4 file system is used in Ubuntu and other current Linux distributions. It has a smarter file allocation method instead of placing multiple files close to each other. On the hard drive. The Linux file system is scattered across different file disks and leaves 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 file system is full or 95% (or even 80%), you may start to see some fragmentation. In short, the file system is designed to avoid fragmentation during normal use. If you have fragmentation problems on your Linux, you may need a larger hard drive. If you do need to defragment the file system, the easiest and most reliable method might be to copy all the files backed up from the partition, then erase all the files from the partition, and then copy the files back to the partition. This way the file system will intelligently copy the files to disk. You can also use the fsck command to measure fragmentation of the Linux file system - look for output "non-adjacent nodes".

Copyright © Windows knowledge All Rights Reserved