You probably don’t want to run programs directly off your USB memory drive

Raymond Chen

You probably wouldn’t want to run Windows or applications directly off your USB memory drive, even if you could. The reason is that the solid-state memory used by these drives support only a limited number of write cycles per block. (Originally measured in the thousands, though I’m led to believe that it’s gone up since then.) Most software assume that a disk’s lifetime is essentially infinite and have no qualms about writing to a file multiple times. For example, your program might decide to group its data in chunks. To modify a byte of the file, you would load a chunk, modify the byte, then write the chunk out. You’ve “spent” a write cycle for an entire chunk of data even though you really might have been able to get away with updating a single sector. What’s more, if that one byte gets modified three times in a row, you just paid for three writes when you could have gotten away with just one if you had just done a little more caching.

Operating systems often update a file’s metadata with high frequency. The last-modified time on a directory entry gets rewritten each time the file is updated. The free block bitmap is updated each time disk space is allocated or released. The page file gets updated constantly. A database application will update its database index very frequently. Even a simple application will probably update its history and settings files often. These “hot spots” are most likely to wear out first on a drive. Unfortunately, these hot spots also tend to coincide with nonrelocatable critical file system metadata; as a result, once the sector responsible for, say, the free cluster table goes bad, the drive is useless (in the absence of hardware sector remapping).

I know some people who wrote a so-called “Flash File System” specifically designed for this class of devices. It spread the writes out across the disk so that it wore uniformly, avoiding the “hot spot” problem. The file system came out in the early 1990’s and promptly died because the hardware hadn’t yet caught up to the software. It was a solution ahead of its time.

Note that my information about the number of write cycles of flash memory is pretty old. Can modern USB drives handle millions of writes before wearing out?

0 comments

Discussion is closed.

Feedback usabilla icon