Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why doesn't Linux need defragmentation?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "Why Linux does not need defragmentation", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn why Linux doesn't need defragmentation.

What are fragments?

Many Windows users, even if they don't have much experience, I'm sure they will defragment regularly to speed up their computers. Many people don't know why they did it.

To put it simply, each hard drive has many sectors, and each sector can contain small pieces of data. For very large files, they must be stored in many different sectors. For example, there are different files saved in the file system, each of which will be stored in a sector of contiguous space. Later, you update your previously saved file to increase the size of the file. The file system will try to store the new part of the file next to the original sector space. Unfortunately, if there is not enough contiguous space, the file must be divided into multiple fragments-which is why the fragments are generated. When your hard drive reads files, the head must skip between different physical locations on the hard drive to read data from each sector-which is why it slows down.

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

Of course, unlike solid state drives, they have no moving parts and should not be defragmented-demarcating SSD actually reduces its useful life. In addition, on the * * version of Windows, you don't have to worry about defragmenting your file system-Windows will do it for you automatically.

How the Windows file system works

Microsoft's old FAT file system, once seen by default in Windows 98 and ME, is now also used on USB flash drives, and it cannot intelligently arrange files. When you save a file to the FAT file system, it saves it as close to the beginning of the disk as possible. When you save the second file, it will be saved immediately after the * * files, 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 little smarter, allocating more "buffer" free space around files on the hard drive. Although, any Windows user can tell you that over time, the NTFS file system will still be fragmented.

As they work with these file systems, they need to be defragmented to ensure that their performance does not degrade. Microsoft's version of Windows can run defragmentation regularly in the background to alleviate this problem.

How the Linux file system works

Linux has ext2, ext3, and ext4 file systems, and the ext4 file system, which is used in Ubuntu and other current Linux distributions, has a smarter way of allocating files rather than putting multiple files close to each other on the hard drive. The Linux file system is scattered on different file disks and leaves a lot of free space. When a file needs to be edited to grow, there is usually enough free space. If fragmentation does occur, the file system will attempt to move the file to reduce fragmentation. Under normal use, no defragmentation tool is required.

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

If you have a fragmentation problem on your Linux, you may need a larger hard drive. If you do need to organize the file system, the easiest and most reliable way is to copy and back up all the files from the partition, clear all the files from the partition, and then copy the files back to the partition. In this way, the file system will intelligently allocate files to be copied to disk.

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

At this point, I believe you have a deeper understanding of "Why Linux does not need defragmentation". 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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report