“对硬盘进行碎片整理(Defrag)”一直是解决 PC 性能问题的万灵药,因为命令行是家用计算机的标准界面。这是一种旨在提高传统机械硬盘性能的技术,但是您需要对SSD进行碎片整理吗?
这些较新的固态磁盘的运行原理与机械驱动器完全不同,那么还有什么理由继续这样做吗?更重要的是,它真的对你的 SSD 有害吗 ?(bad )
要了解这些问题的答案,我们必须深入了解对SSD驱动器进行“碎片整理”意味着什么。
碎片整理的重点是什么?(What’s The Point Of Defragmentation?)
“碎片化”是数据写入设备的自然结果,每个驱动器都会发生这种情况。格式化驱动器时,您将其存储空间划分为一个组织有序的系统。驱动器的地图,它允许计算机准确地知道每个(字面)信息的位置。
在新格式化的驱动器上,新数据以不间断的顺序写入。但是,当您删除一个文件时,它会在该顺序中留下一个间隙。计算机将该空间标记为可被覆盖。到现在为止还挺好。
问题是您的新数据可能无法完全适应该差距。因此,操作系统将用它正在写入的文件的第一部分来填补空白,然后寻找下一个开放空间——导致数据碎片散布在驱动器上。
正如您可以想象的那样,这使得读取完整文件或一组相关文件变得更加棘手,因为您需要从一个位置跳到下一个位置。它也可能导致性能问题。至少,它一直用于机械驱动器。为什么?
为什么机械驱动器(理论上)需要良好的碎片整理(Why Mechanical Drives (Theoretically) Need a Good Defrag)
在SSD(SSDs)出现之前,机械硬盘驱动器被称为“硬盘驱动器” ,将数据存储在涂有磁性材料的玻璃或铝盘上。盘片以每分钟数千转的速度旋转,精致的读/写磁头在其表面上方快速移动读写信息。
数据按轨道排列,如果您的数据都排成一行,这意味着磁头可以只停留在一个地方并吸纳所有这些位。如果驱动器碎片化,则意味着磁头必须到处移动才能获取您要求的数据。由于它们是具有相当大质量的物理对象,因此可以多快完成此操作是有限度的。
当您对驱动器进行碎片整理时,计算机会重新排列其所有数据,使用驱动器上的可用空间作为排序空间。这是一个庞大而耗时的过程。但是,在高度分散的驱动器上,它可能会对系统响应能力产生显着影响。至少在较旧的硬件上。
你看,多年来,机械驱动器已经变得更快、更高效。更高的数据密度、更多的磁头、更多的盘片、更高的RPM(RPMs)和更好的驱动电子设备都使新硬盘驱动器更快。如此之多,以至于在大多数情况下,碎片化的影响确实不值得费心。
如今,计算机也有如此多的RAM,以至于操作系统可以缓存驱动器中的信息。现代(Modern)机械硬盘驱动器本身具有较大的缓冲区,可以消除其设计的机械限制。所以最后,即使对现代驱动器进行碎片整理也可能不会带来任何明显的性能提升。
您需要对 SSD 进行碎片整理吗?(Do You Need To Defrag An SSD?)
结束所有这些序言后,我们就进入了主要问题——您需要对SSD进行碎片整理吗?最简洁的答案是不。
有两个主要原因。第一个与缺乏性能优势有关,这毕竟是碎片整理的重点。第二个原因与SSD的健康状况有关。事实证明,对SSD进行碎片整理会缩短其使用寿命
SSD 性能和碎片整理(SSD Performance and Defragmentation)
正如我们刚刚看到的,碎片影响机械硬盘驱动器性能的全部原因是因为它给进程增加了越来越多的机械延迟,因为磁头疯狂地跳来跳去寻找文件的不同部分。
就其本质而言,SSD(SSDs)没有这个问题。它们根本没有机械部件。它们将信息存储在以电子方式读取的存储芯片中。
虽然SSD(SSDs)会像机械驱动器一样变得碎片化,但如果数据都在一个地方或分散在驱动器上的不同位置,这对SSD没有任何影响。(SSD)“寻道时间”几乎不受此影响。因此,对 SSD 进行碎片整理对SSD性能(SSD)的影响几乎为零。
SSD 磨损(SSD Wear and Tear)
即使对机械驱动器进行碎片整理实际上可能不会使其性能更好,但至少除了占用计算机时间之外没有任何害处。另一方面,使用SSD ,碎片整理实际上可以帮助杀死它。(SSD)
如果您想确切了解原因,请务必查看我们关于SSD 磨损(wear & tear)的深入文章。简短的解释是,每次您擦除数据并向其中写入新信息时, SSD存储单元都会退化。(SSD)现代SSD(SSDs)在重复磁盘写入时可能会受到很多惩罚。他们使用复杂的“磨损均衡”技术尽可能延长每个存储单元的使用寿命。
但是,由于碎片整理不会留下任何数据,如果您定期对驱动器进行碎片整理,您将很快将您的SSD变成镇纸。
TRIM 和优化:将碎片整理发送到垃圾箱(TRIM and Optimization: Sending Defrag To The Dustbin)
碎片整理可能是一个最好留给计算机历史垃圾箱的过程。至少在用于一般日常性能目的的家用计算机方面。它的发明是为了解决一个在现代基本上已成为非问题的问题。
因此,我们不仅强烈建议不要在SSD上使用碎片整理,而且您可能也不必费心在现代机械驱动器上进行碎片整理。
话虽如此,Windows 10 碎片整理工具(Windows 10 defragmentation tool)知道固态驱动器和机械驱动器之间的区别。它不是自动对SSD进行碎片整理,而是使用“TRIM”命令,这是一种专门的SSD优化命令,以及一些碎片管理措施,但与传统硬盘驱动器上使用的蛮力碎片整理完全不同。
Should You Defrag an SSD?
“Defrag your hard drive” has been the cure-all advice for PC performance wоes since the command line was the standard interfаce for home computers. It’s a technique meant to improvе the performance of traditional mechanical hard drives, but do you need to defrag an SSD?
These newer solid-state disks operate on completely different principles than mechanical drives, so is there any reason to still do it? More importantly, could it actually be bad for your SSD?
To understand the answers to these questions, we have to dig a little under the surface of what it means to “defrag” an SSD drive.
What’s The Point Of Defragmentation?
“Fragmentation” is something that happens to every drive as a natural result of data being written to the device. When you format a drive, you’re dividing its storage space into a neatly organized system. A map of the drive which allows the computer to know exactly where every (literal) bit of information is to be found.
On a freshly formatted drive, new data is written in an unbroken sequence. However, when you delete a file, it leaves a gap in that sequence. The computer marks that space as available to be overwritten. So far, so good.
The problem is that your new data probably won’t fit neatly into that gap. So the operating system will fill up the gap with the first part of the file it’s writing and then look for the next open space – leading to fragments of data spread across the drive.
As you can imagine, this makes reading a complete file or set of related files trickier, since you need to hop from one location to the next. It can also be a recipe for performance problems. At least, it has been for mechanical drives. Why?
Why Mechanical Drives (Theoretically) Need a Good Defrag
Mechanical hard drives, which were just called “hard drives” until SSDs came along, store data on glass or aluminum platters coated with magnetic material. The platters spin at thousands of revolutions per minute and delicate read/write heads skit about above their surface reading and writing information.
The data is laid out in tracks and, if your data is all in a neat line, it means the head can just stay in one place and hoover up all those bits. If the drive is fragmented, it means that the heads have to move all over the place to get the data you asked for. Since they are physical objects with a fair amount of mass, there’s a limit to how quickly this can be done.
When you defragment a drive, the computer reshuffles all its data, using the free space on the drive as sorting space. It’s a massive, time-consuming process. However, on heavily fragmented drives it could make a noticeable difference to system responsiveness. At least on older hardware.
You see, mechanical drives have become significantly faster and more efficient over the years. Much higher data density, more heads, more platters, higher RPMs and better drive electronics have all made new hard drives much faster. So much so, that the effects of fragmentation really aren’t worth the bother in most cases.
Computers also have so much RAM these days, that operating systems can cache information from the drive. Modern mechanical hard drives themselves have large buffers, that can smooth out the mechanical limitations of their design. So in the end, even defragging a modern drive probably won’t result in any noticeable performance gains.
Do You Need To Defrag An SSD?
With all of that preamble out of the way, we get to the main question – do you need to defrag an SSD? The short answer is no.
There are two main reasons. The first relates to the lack of performance benefits, which is, after all, the entire point of defragmentation. The second reason has to do with the health of your SSD. It turns out that defragging an SSD can shorten its life
SSD Performance and Defragmentation
As we’ve just seen, the whole reason fragmentation affects mechanical hard drive performance is because it adds more and more mechanical latency to the process, as the heads madly jump around to find the different parts of your files.
By their very nature, SSDs don’t have this problem. They have no mechanical parts at all. They store information inside memory chips, which are read electronically.
While SSDs become fragmented just the same as a mechanical drive, it makes no difference to the SSD if the data is all in one place or scattered around various locations on the drive. The “seek time” is virtually unaffected by this. So defragmenting an SSD would make just about zero difference to your SSD performance.
SSD Wear and Tear
Even if defragging a mechanical drive may not actually make it perform any better, at least it does no harm other than taking up computer time. With an SSD on the other hand, defragging can actually help kill it.
If you want to understand exactly why that is, be sure to check out our in-depth article on SSD wear & tear. The short explanation is that SSD memory cells degrade every time you erase data and write new information to them. Modern SSDs can take a lot of punishment when it comes to repeated disk writes. They use sophisticated “wear levelling” technology to extend the lifespan of each memory cell as much as possible.
However, since defragmentation leaves no bit of data untouched you’ll quickly turn your SSD into a paperweight if you regularly defrag the drive.
TRIM and Optimization: Sending Defrag To The Dustbin
Defragmentation is probably a process best left to the dustbin of computer history. At least in terms of home computers for general day-to-day performance purposes. It was invented to combat a problem that has become largely a non-issue in modern times.
So it’s not just that we strongly recommend against using defragmentation on an SSD, but also that you probably don’t have to bother with doing it on a modern mechanical drive either.
That being said, the Windows 10 defragmentation tool knows the difference between solid state drives and mechanical drives. Instead of automatically defragmenting an SSD, it instead uses the “TRIM” command, which is a specialized SSD optimization command, as well as some measure of fragmentation management, but nothing like the brute force defragmentation used on traditional hard drives.