Defragmenting a hard drive makes sense to me because the hard drive read arm has to jump around the disk for fragmented files; but what about flash drives? If all the data is just stored in solid state memory, it seems like accessing those memory addresses won’t take any longer, whether they are consecutive or spread in different places.
You’ve hit one nail squarely on the head: flash devices and SSDs don’t gain significant performance benefit from being defragmented.
In reality, things could get worse. Much, much worse.
Become a Patron of Ask Leo! and go ad-free!
Traditional hard disks are rotating disks of magnetic material with a read/write head that has to move around to find the data. Files are stored in pieces – frequently in 512 byte “chunks” which may or may not actually be physically next to or even near each other. That means a file could have its contents spread out randomly over a hard disk’s physical surface.
You normally never see this, because the file system – that “NTFS” or “FAT32” thing you may see referenced from time to time – takes care of locating all those chunks when you read or write a file.
There’s a physical read/write head that moves around on the media when data is being accessed. Much like the laser in a CD player (or the needle on a record player), the disk spins underneath while the head moves in and out to locate the proper “track” that contains the next chunk of the file being accessed.
While it moves very fast, moving that read/write head still takes time. If you can ensure that all the chunks of a file are next to each other rather than spread out all over, the head doesn’t need to move as much, and reading the file is faster.
That’s defragmenting, or “defragging”, in a nutshell: rearranging the chunks so when the time comes to access a particular file, they’re all together, and the read/write head doesn’t need to move as much.
Solid state disks
The “magic” behind flash drives and SSDs (Solid State Drives) is that they’re built using electronic circuitry with no moving parts. There’s no disk to spin, and no read/write head to move around. Everything that makes it look and act like a hard drive is actually done by mimicking the characteristics of a hard drive in the solid state drive’s circuitry.
The difference in performance can be dramatic.
Many machines now come with SSDs as their primary disks, and one of the cheapest approaches to speeding up an older machine is to replace its older mechanical hard disk with an SSD.
Flash versus SSD
Both USB flash drives and SSDs are solid state drives.
USB flash drives, (also called thumb drives, USB sticks, or any number of other things), are, in essence, SSD’s slower, cheaper cousin.1 They both use what’s referred to as “flash memory” to act in place of traditional hard disks’ magnetic surface.
The difference is that SSDs are larger, faster, and longer lasting – which, as we’ll see in a moment, turns out to be important in a surprising way. Also, SSDs are typically designed to be a component installed in your computer, like a traditional hard drive.
Defragging solid state drives
Defragging a solid state drive will typically gain no performance benefits2. Since there’s no head to move, there’s no additional time cost in fetching one chunk of data from a flash drive over any other. It doesn’t matter how the files are laid out; it’s all just as fast.
Here’s the part where things gets worse.
Writing to the flash memory used in SSDs and thumb drives causes it to degrade ever so slightly. Reading does not.
Thus, the more you write to a solid state drive, the shorter its lifespan will be.
Now, don’t get me wrong, “normal” usage should be just fine. And the technology continues to improve almost daily. As I mentioned above, SSDs tend to be higher quality than inexpensive USB thumbdrives. They’re at a point now where under normal usage, they can outlast the machines into which they are placed.
But still … solid state drives wear out.
Defragging hurts solid state drives
Defragmenting a drive is all about moving the data around on the drive. That means reading it from one location and writing to another.
If you’re regularly defragging a flash drive, you’re adding thousands upon thousands of write operations each time you do so. Whatever the expected lifespan of the device, you could easily be cutting it in half, or worse.
For no benefit.3
So defrag your hard drives every so often, but never defrag your flash drives. There’s little to gain and much to lose.
Defragging and Windows
Recent versions of Windows do just the right thing. (Or rather, they won’t do the wrong thing.)
Windows will note that you have a solid state drive and actually not allow you to defragment it. Even better, once a week Windows will automatically defrag the disks that need defragging, and not defrag the drives for which it’s not appropriate.
You need do nothing at all.
Except … don’t defrag that USB stick. At least not without a proper backup of its contents … which you should do anyway.
Forcing the issue
It’s funny. Immediately after I say, “Don’t do that”, someone will ask, “How do I do it anyway?”
Fine. Windows won’t let you, but most third-party defragmenting tools assume you know what you’re doing when you ask to defrag a drive – any drive. Piriform’s Defraggler is the tool I use when I want something a little more extensive than Windows’ own defragging tool.
And yes, I took a sacrificial thumb drive and defragmented it. No, it didn’t immediately fail or burst into flames.
But that’s kinda the point. The defragmenting operation shortened its life. It will fail sooner, and without warning.
Which, naturally, brings me back to backing up.
Which you should be doing anyway.
Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
I'll see you there!