In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains why Linux doesn't need to be defragmented. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor learn why Linux doesn't need to be defragmented.
What is disk fragmentation?
Many Windows users, even some inexperienced users, believe that regularly defragmenting the file system will make their computers run faster. But they don't know why.
To put it simply, a hard drive contains many sectors, each of which can store a small piece of data. For files, especially larger ones, they must be stored in many different sectors. Suppose you have many different files in your file system, each of which is stored in a contiguous sector group. Then, you increase the size of one of the files. The file system first attempts to store the newly added part of the file in a sector next to the original sector group. But if there are not enough contiguous sectors, the file must be broken down into small chunks, all of which are visible to you. When your hard drive reads these files, its head must jump between different physical locations to read a continuous group of sectors, which slows it down.
Defragmentation is a precise process of reducing fragmentation by moving files bit by bit (bits is the smallest unit in which files are stored on disk) to ensure that each file is stored continuously on the hard disk.
Of course, this is a little different for SSDs, which don't need to move files or defragment. Because defragmentation of a SSD (solid state drive) reduces its lifespan. And, in the latest version of Windows, you no longer need to worry about defragmentation, because Windows will automatically do it for you.
How the file system of Windows works
The FAT file system previously used by Microsoft-- last seen as the default system in Windows 98 and ME, although it is still used in USB drives-- does not arrange files very well. When you save files in the FAT file system, it arranges the files at the top of the disk as much as possible. When you store the next file, it will store the file directly after the first file, and so on. So when the file gets bigger, there will always be fragments, because there is no room next to the file to store the additions.
The newer NTFS file system used by Microsoft in Windows XP and 2000 is trying to get smarter. The file system will put more free space called "buffers" around the files, but any Windows user will tell you that the NTFS file system will one day be fragmented.
Because of the performance of file systems, they need to be defragmented to maintain performance. Microsoft can only alleviate this problem by automatically running the defragmenter in the background in the latest version of Windows.
How the file system of Linux works
Linux's ext2,ext3,ext4 filesystem-- ext4 is the filesystem used by Ubuntu and most current distributions-- places files in a smarter way. Linux's file system spreads files across the disk, leaving a lot of free space between files, rather than placing files one after another, as Windows does. When a file is edited and becomes larger, there is usually enough free space to save the file. If fragmentation does occur, the file system will try to move files in daily use to reduce fragmentation, so there is no need for a special defragmenter.
Because of the way it works, you may see fragments after your file system is full. If 95% (or even 80%) of the file system is occupied, you will start to see some fragments. However, such a file system is designed to reduce fragmentation in common use.
If you do have a problem with fragmentation on Linux, you may need a bigger hard drive. If you really need to defragment a file system, the easiest and most reliable way is to copy all the files, then empty the original partition, and then copy the files back. The file system will intelligently place the files as you copy them back.
You can use the fsck command to check the fragmentation of a Linux file system, just check the number of discontiguous I nodes (non-contiguous inodes) in the output.
At this point, I believe that you have a deeper understanding of why Linux is not defragmented, so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.