Nothing lasts forever.
I have a database application that I share between multiple computers. We keep the database itself on a USB flash drive and simply move that drive to the other computers as needed. The database is never copied off the flash drive, we just update it in place. Seems very simple.
A friend of mine just told me that I was asking for trouble. He said something about flash drives “wearing out”, and that sooner or later, probably sooner, the data on my flash drive would become corrupt. Is that true? Do these USB drives actually wear out?
I strongly recommend that you back up the drive’s contents sooner rather than later. You should also rethink how you’re sharing data.
Flash memory “wears out”.
Become a Patron of Ask Leo! and go ad-free!
Flash Drives Wear Out
Inexpensive flash drives are not appropriate for high-write usage, because they wear out the more they are written to. SSDs, also based on a type of flash memory, are generally more expensive, higher quality, and will probably outlast the useful life of the machines in which they’re used.
Putting the flash in flash memory
Flash memory chips are so-called because in order to write to them, the memory is loaded, and then a signal is sent to the circuitry saying “remember this”, kind of like the flash on a camera.1
Once the memory has been “flashed”, power can be completely removed, and the memory will retain whatever was written to it.
The problem is memory can be flashed only so many times. When the limit is reached, some portion of the memory may not properly remember what was written to it.
It may only take a single bit of information to be wrong or to “wear out”, for the entire contents of a flash memory chip to be lost.
Error correction and wear leveling
Flash memory chips often include circuitry to avoid “bad bits”.
If a portion of the flash memory finally wears out and goes bad, the chip itself can compensate. It looks to the user like everything is fine.
Another approach is called “wear leveling.” This spreads the use of flash memory across the entire device, even if you’re only writing to the same spot in the same file every single time.
But these techniques only postpone the inevitable.
In your example, you’re using your USB flash drive in perhaps the worst possible way for longevity. Database applications are notorious for writing to the disk a lot as tables, fields, indexes, and the like are updated. Even if you don’t write or update information in your database, the files may be updated with things like “last access” information and other administrivia.
The result is the USB flash drive is being written to. A lot.
With all that writing going on, reaching the failure point of some random bit or bits in the flash memory stick doesn’t seem that far-fetched. Remember, in the unluckiest case, it might only take one worn-out bit of information to render the entire contents unreadable.
Using inexpensive flash memory
The best use of USB flash drives and other flash memory-based devices is simply copy-to and copy-from. Copy the information to the thumb drive to store it, copy it from the thumb drive to a local hard disk to use it, and then copy it back to the thumb drive to store it.
Never run disk-intensive applications directly against files stored on inexpensive flash drives.
You may note your application speeds up when you copy your database to the hard disk for use. While reading flash memory is typically quite fast, writing is not.
If you really need external storage, a thumb drive may simply be the wrong solution. There are plenty of external hard drives that could do the same job without the write limitations. Or perhaps a networked solution is the way to go.
Knowing that inexpensive flash memory-based devices will wear out eventually, there’s one other thing you need to make sure to do: back up.
If you keep your only copy of important data on a flash drive you’re asking for trouble. It will wear out eventually, and your data will become completely unrecoverable.
Remember the “golden rule” of backing up:
If it’s in only one place, it’s not backed up.
If your data exists only on a flash drive, its days are numbered.
What about SSDs?
SSDs or Solid State Drives are indeed based on flash memory. And yes, they will wear out too.
Just not as quickly.
There is a difference between the “inexpensive” flash memory I’ve discussed and the flash memory used in SSDs.
USB thumb drives; CF, SD, and microSD memory cards are all relatively cheap. The type of flash technology they use is, as I’ve described, susceptible to wearing out if written to “too much”, and can wear out from regular use over time.
Not quite so for SSDs.
SSDs use more expensive flash technology and are engineered differently than their inexpensive cousins. Even as prices come down, the technology remains different, and often physically larger.
The same problem still applies: an SSD will wear out, it just takes a lot longer to do so. In fact, it’s not unreasonable to assume an SSD used as the primary drive in a computer can outlast the useful lifespan of the computer itself; again, depending on how it’s used. It’ll wear out eventually, but you’ll likely have moved on to another machine before that time.
Remember any media can and will fail. The differences we’re talking about have to do with how quickly, on average, the failure will happen. Again, based on use, traditional spinning hard drives and SSDs will significantly outlast inexpensive flash drives.
And you need to be backing them up.
All of them.
Use flash drives appropriately. Use SSDs for your systems, when it makes sense. Back up everything, and then subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
Footnotes & References
1: In all honesty, I don’t know if modern flash memory uses this exact technique, but it remains a fairly accurate metaphor for the process.