Ask Leo! by Leo A. Notenboom

Should I defragment my USB Flash drive?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Hardware » Disks and Mass Storage

Summary: We've all been told that defragmenting a hard disk is a good thing for performance, but the same is most definitely not true for flash drives.

Is it ever necessary to defragment a USB flash drive?

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 memory, it seems like accessing those memory addresses won't take any longer, whether they are consecutive or spread in different places. And if it is necessary to defragment a flash drive, then it seems like we could also argue that we need to defragment our RAM from time-to-time!

You've hit one nail squarely on the head: flash devices (or any "solid state" devices) don't gain a performance benefit from being defragmented.

But in reality things get worse. Much, much worse.

You should never defragment a flash drive.

Files are stored on hard disks in pieces; frequently in 512 byte chunks. Now, there's no requirement that these chunks be next to, or even near each other. That means that a file could have its contents spread out in totally random places on the hard disk. You normally never see this, because the file system takes care of locating all those chunks when you read or write a file.

On a traditional hard disk 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 it, while the head moves in and out to locate the proper "track" that contains the next chunk of the file that's being accessed.

"The more you write to a flash device the shorter its lifespan will be."

Moving that read/write head takes time.

So, if you can ensure that all the chunks of a file are next to each other or "contiguous", the head doesn't need to move as much, and reading the file is faster.

And that's what defragmenting, or "defragging", a hard disk is all about: rearranging where on the disk the file chunks are stored so that when the time comes to access a particular file, all the chunks are together and the read/write head doesn't need to move as much.

Flash drives have no read/write head.

In fact, flash drives have no moving parts at all. Everything that makes it look and act like a hard drive is actually done by mimicking the characteristics of a hard drive in the flash drive's circuitry.

Defragging a flash drive will get you no performance benefits. 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.

So now that I've convinced you that there's no point in defragging a flash drive, why did I say that you should never do it?

Flash memory wears out.

Writing to flash memory causes it to degrade ever so slightly. (Reading does not.) The more you write to a flash device 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. Not only is the underlying technology improving, but the techniques to mitigate the problem are improving as well. For example, most flash drives try to "spread out" write activity across the entire device, so that even if you're constantly re-writing the same data over and over again, the device will "move it around" so you're not wearing a single spot on the device faster than any other.

But still ... flash memory wears out.

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.

(Full disclosure: OK, a reader did comment on a prior article with a potential benefit - defragmented files are easier for recovery utilities to recover. Fair enough. In my opinion that's not even close to a good enough reason to shorten your flash drive's lifespan. Use a good backup strategy instead.)

So defrag your hard drives every so often. But never defrag your flash drives, there's just no point.

Related:

Helpful? Get new articles weekly by email in my FREE newsletter!

Your Name:
Your Email:


Why Subscribe?

Article C3296 - February 19, 2008

Was this article helpful? «Yes» «No»

Recent Comments
17 Comments

Another reason to avoid it is that it may just stop working! I defragged a flash drive, and now I'm told that it's unformatted! To make matters worse, after I discovered this, I remembered doing exactly same thing and having the same problem a couple of years ago. Alas, life's tough when you're thick.

Posted by: Ashamed at May 20, 2009 2:22 AM

im not understanding as to why defraging is so bad for the flash drives..these flash drives,they contail the same memory chips as our pc memory itself uses..and pc memory never goes bad..unless you put it in backwards or somehow manage to fry it lol..in a way it makes sense,,but on the other side..memory is memory ..weather its being written to or used in I/O cycles..just a thought i had in my head...i could be wrong lol

Yes, you are wrong. Flash memory is a VERY different kind of memory than what's in your PC. When you turn off your PC the RAM in your PC loses everything in it. Flash memory retains what's in it when the power is removed. Flash memory wears out the more you write to it, and defragging is a VERY write-intensive operation. (Not to mention that defragging is nearly pointless on memory-based drives.)
Leo
24-Sep-2009

Posted by: shawn at September 23, 2009 10:05 PM

Defragging flash media DOES reduce its life-span, however, your reasons are slightly off. The life-span of flash drives are NOT reduced by writing to the drive. Flash memory uses a phenomenon (known as Fowler-Nordheim tunneling) to send electrons through a floating gate transistor where it remains even after power is turned off. This process does not "wear out" the media. Flash memory gets its name from the technique used to erase its data. To write data, an electric charge is sent through one transistor, called the floating gate, then through a metal oxide layer, and into a second transistor called the control gate where the charge is stored in a cell until it's erased. To reset all values, a strong electrical field, called a (yep, you guessed it) "flash", is applied to the entire card. Flash drives have two limitations: The bits can be erased only by applying the flash to a large block of memory and, with each ERASURE (not write), the block becomes less stable. In time (after 10,000 to 1,000,000 uses) a flash memory device will no longer reliably store data.

Posted by: Beau M at November 9, 2009 11:57 PM

http://operation420.net/forum/viewtopic.php?f=45&t=1129

Great article, may I have permission to post it on my forum instead of just linking to it? I prefer reposting instead of just linking because there are times I posted links to articles that went down.

Unfortunately, no, I can't authorize a complete copy of my article, for several reasons. If you take a look a the terms you'll see that you can publish partial content that links back here. (I understand your concern, but I plan to keep this content up for quite a while Smile).
Leo
05-Dec-2009

Posted by: MPG at December 3, 2009 3:49 PM

I have accidentally deleted some of my important data's from MacBook's USB Flash Drive.Can I get it back using MacBook Data Recovery software, as defragmanet it before the data loss. Please help.

Posted by: Nancy Johnson at January 29, 2010 1:56 AM

Post a comment on "Should I defragment my USB Flash drive?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

  • Read the article at the top of this page. If your comment shows you didn't, it'll be deleted and ignored.

  • Comment only on this article. Use the Google search box at the top of the page if you have a question about something else.

  • Don't include personal information in the comment. No email addresses. No phone numbers. No physical addresses.

  • Don't spam. Excessive links to unrelated sites within a comment or across multiple comments will cause all such comments to be removed.

  • Don't ask me to recover lost passwords or hacked accounts. I can't, and those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...


Question? Ask Leo!