ext3 / ext4 on USB flash drive?

Theodore Ts'o
Thu, 29 Aug 2013 15:46:57 -0000

On Thu, Aug 29, 2013 at 12:56:35PM +0100, Mark Ballard
wrote:
> I think this is really an attempt at user feedback, rather than user
> discussion. But there's no such thing as a user-feedback mail list.
>
> Nevertheless, others may find this pertinent: why doesn't mke2fs
> handle USB's competently? And if it does, why doesn't it reassure
me
> so? And how can I handle a linux-formatted USB flash drive in the
> absence of my system giving me any guidance?

The problem is that it really depends on the quality of the flash
drive.   Two main things drive this:

1)  Whether the flash used in the drive is SLC. MLC, or TLC.  This
will tell you how many write cycles the flash can support.  This is
where you will see numbers such as 10,000 write cycles, all the way
down to 1,000 write depending on the quality of the flash used.

2) The quality of the Flash Translation Layer (FTL).  The important
thing to remember here is that not all parts of the storage device
will get used to the same amount.  Some files will rarely change once
they are installed on the device; others will change a huge amount.
So a good Flash Translation Layer will spread out the wear so that if
you have a 120GB device, with flash cells that support 10,000 write
cycles, that ideally you can support up to 10,000 times 120GB == 120
TB worth of writes.  Of course, that assumes 100% efficiency, which is
unrealistic.  But some FTL's are incredibly bad, and in the worst
case, if they aren't spreading the wear around at all, if you write a
single block 1,000 times, and the flash only supports 1,000 write
cycles, then that block will go bad.

Unfortunately, the cheapest USB flash devices that you find in the
bargain bin at the checkout counter of the Micro Center tend to use
the crappiest flash media possible, and the crappist FTL's.  Some even
will only have 512MB of flash even though it is advertised as having
8GB of flash, such that if you ever write more than 512MB worth of
files on the flash, you will start losing data.  (Fortunately most
people don't actually use the full capacity of their USB sticks, which
is why the manufacturers can get away with this kind of fraud.)

So this is fundamentally a problem with the quality of the hardware,
and that's not something the file system can really compensate for.
And there's no way to tell whether a particular USB device has has a
high quality flash device, or is a craptastic flash device.  It's not
like we can query the device for "I ripped off the purchaser" bit.
:-)

Regards,

					- Ted