If you’re a Linux user, you’ve probably heard that you don’t need to defragment your Linux file systems. You’ll also notice that Linux distributions don’t come with disk-defragmenting utilities. But why is that?

To understand why Linux file systems don’t need defragmenting in normal use – and Windows ones do – you’ll need to understand why fragmentation occurs and how Linux and Windows file systems work differently from each other.

What Fragmentation Is

Many Windows users, even inexperienced ones, believe that regularly defragmenting their file systems will speed up their computer. What many people don’t know is why this is.

In short, a hard disk drive has a number of sectors on it, each of which can contain a small piece of data. Files, particularly large ones, must be stored across a number of different sectors. Let’s say you save a number of different files to your file system. Each of these files will be stored in a contiguous cluster of sectors. Later, you update one of the files you originally saved, increasing the file’s size. The file system will attempt to store the new parts of the file right next to the original parts. Unfortunately, if there’s not enough uninterrupted room, the file must be split into multiple pieces – this all happens transparently to you. When your hard disk reads the file, its heads must skip around between different physical locations on the hard drive to read each chunk of sectors — this slows things down.

Defragmenting is an intensive process that moves the bits of files around to reduce fragmentation, ensuring each file is contiguous on the drive.

Of course, this is different for solid state drives, which don’t have moving parts and shouldn’t be defragmented – defragmenting an SSD will actually reduce its life. And, on the latest versions of Windows, you don’t really need to worry about defragmenting your file systems – Windows does this automatically for you. For more information on best practices for defragmenting, read this article:

HTG Explains: Do You Really Need to Defrag Your PC?

How Windows File Systems Work

Microsoft’s old FAT file system – last seen by default on Windows 98 and ME, although it’s still in use on USB flash drives today – doesn’t attempt to arrange files intelligently. When you save a file to a FAT file system, it saves it as close to the start of the disk as possible. When you save a second file, it saves it right after the first file – and so on. When the original files grow in size, they will always become fragmented. There’s no nearby room for them to grow into.

Microsoft’s newer NTFS file system, which made its way onto consumer PCs with Windows XP and 2000, tries to be a bit smarter. It allocates more “buffer” free space around files on the drive, although, as any Windows user can tell you, NTFS file systems still become fragmented over time.

Because of the way these file systems work, they need to be defragmented to stay at peak performance. Microsoft has alleviated this problem by running the defragmentation process in the background on the latest versions of Windows.

How Linux File Systems Work

Linux’s ext2, ext3, and ext4 file systems – ext4 being the file system used by Ubuntu and most other current Linux distributions – allocates files in a more intelligent way. Instead of placing multiple files near each other on the hard disk, Linux file systems scatter different files all over the disk, leaving a large amount of free space between them. When a file is edited and needs to grow, there’s usually plenty of free space for the file to grow into. If fragmentation does occur, the file system will attempt to move the files around to reduce fragmentation in normal use, without the need for a defragmentation utility.

Because of the way this approach works, you will start to see fragmentation if your file system fills up. If it’s 95% (or even 80%) full, you’ll start to see some fragmentation. However, the file system is designed to avoid fragmentation in normal use.

If you do have problems with fragmentation on Linux, you probably need a larger hard disk. If you actually need to defragment a file system, the simplest way is probably the most reliable: Copy all the files off the partition, erase the files from the partition, then copy the files back onto the partition. The file system will intelligently allocate the files as you copy them back onto the disk.

中文翻译版本:http://my.oschina.net/liux/blog/61636


==============================================================================
本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/articles/2545316.html,如需转载请自行联系原作者

HTG Explains: Why Linux Doesn’t Need Defragmenting相关推荐

  1. 为什么LINUX不需要碎片整理(Why Linux Doesn’t Need Defragmenting)

    如果您是Linux用户,您可能听说过不需要对Linux文件系统进行碎片整理.您还会注意到Linux发行版没有提供磁盘碎片整理工具.但这是为什么呢? 要理解为什么Linux文件系统在正常使用时不需要碎片 ...

  2. dnf提示磁盘碎片需要整理_什么是磁盘碎片?我还需要进行碎片整理吗?

    dnf提示磁盘碎片需要整理 Do modern computers still need the kind of routine defragmentation procedures that old ...

  3. dsp怪胎_2012年6月最佳怪胎文章

    dsp怪胎 This past month we covered topics such as why you only have to wipe a disk once to erase it, w ...

  4. kl变换简单的解释入门_2010年20个最佳入门指南解释者主题

    kl变换简单的解释入门 It's near the end of 2010, and we've put together a list of the 20 best "Explainer& ...

  5. 转载:为什么Linux不需要磁盘碎片整理

    转载自:www.aqee.net 如果你是个Linux用户,你可能听说过不需要去对你的linux文件系统进行磁盘碎片整理.也许你注意到了,在Liunx安装发布包里没有磁盘碎片整理的工具.为什么会这样? ...

  6. Ubuntu 12.10中的8个新功能,Quantal Quetzal

    Ubuntu 12.10 has been released and you can download it now. From better integration with web apps an ...

  7. 自定义异常最佳实践_播放,自定义和组织媒体的最佳文章

    自定义异常最佳实践 Computers today are used for much more than generating documents, writing and receiving em ...

  8. 加密机是如何工作的_什么是加密,它如何工作?

    加密机是如何工作的 Encryption has a long history dating back to when the ancient Greeks and Romans sent secre ...

  9. ubuntu 装在ssd_如何在Ubuntu中调整SSD以提高性能

    ubuntu 装在ssd There are lots of tips out there for tweaking your SSD in Linux and lots of anecdotal r ...

最新文章

  1. 分布式下必备神器之分布式锁
  2. 安装node和pm2
  3. C#对事务的代码封装
  4. 作者:张晴晴,山东农业大学硕士生。
  5. java 指针 地址压缩_JVM优化之压缩普通对象指针(CompressedOops)
  6. ERP-非财务人员的财务培训教(四)------公司/部门的成本与费用控制
  7. 【使用Ubuntu SDK】入门篇——qtcreator 运行qmlscene时 module Ubuntu.Components is not installed 错误分析和解决...
  8. SQL Server BI Step by Step SSIS 5 --- 通过Email发送查询结果
  9. leetcode之移除链表的元素
  10. C# 色系表配色 颜色表 美工必备
  11. Oracle12c CDB和PDB数据库的启动与关闭说明
  12. HIVE一些字符处理
  13. 沁恒微USB蓝牙单片机CH573F初步熟悉
  14. 让 snoop 支持 .NET Core WPF 调试
  15. 吉他指弹特殊调弦的方法及基础音阶知识
  16. 基于CSS的个人网页
  17. python怎么判断倍数_如何判断一个数是否是七的倍数?
  18. 小满网络模型http1-http2 浏览器缓存
  19. 深度学习——神经网络的学习
  20. excel VBA 字典与集合(Dictionary与Collection)

热门文章

  1. python中hist函数参数_用hist参数解释Python,python,解读
  2. 谈“发表(撰写)学术论文的注意事项”
  3. LED音乐频谱之点阵
  4. CentOS6找回root密码 - 黑猴子
  5. elasticsearch的插件安装
  6. 轻量级文本编辑器,Notepad最佳替代品:Notepad++
  7. Sql 行转列问题总结
  8. JavaScript调用Web Services实现无刷新三联动
  9. 关于各种JOIN连接的解释说明【原创】
  10. nodejs常用模块-url