| |
Log in / Subscribe / Register

Optimizing Linux with cheap flash drives

Optimizing Linux with cheap flash drives

Posted Feb 20, 2011 3:25 UTC (Sun) by Oddscurity (guest, #46851)
In reply to: Optimizing Linux with cheap flash drives by arnd
Parent article: Optimizing Linux with cheap flash drives

So in summary, if I want to run an ext3 filesystem on a USB stick, I'm better off formatting the stick as FAT32 and then running the ext3 as a loop?

Or would that be the wrong conclusion?

Not that it's all I took away from this great article, but I'm wondering what I can do in the meantime to optimise my use with such devices.


Optimizing Linux with cheap flash drives

Posted Feb 20, 2011 4:07 UTC (Sun) by ewen (subscriber, #4772) [Link] (2 responses)

Alas, no, running ext3 in a loop on FAT32 doesn't magically change your file system access patterns from ext3 access patterns to FAT access patterns. (Eg, in that scenario the FAT would hardly ever change since you allocate a huge file for the loop and then just write within it, versus native FAT32 with it changing with each file change, so the cheap flash drives optimisation for the 4MB holding the FAT would be wasted; and you'd still get random updates frequently in "unexpected" -- by the naive firmware -- locations.)

It appears if you want to run ext3 on a cheap flash drive, you pretty much have to assume that it's going to be slower than advertised (possibly MUCH slower, especially for write), and that there's a very real risk of wearing out some areas of the flash faster than might be expected. Probably okay for a mostly-read workload if you ensure that you turn off atime completely (or every read is also a write!), but not ideal for something with regular writes.

If it's an option for your use case, then sticking with the original FAT file system -- and using it natively -- is probably the least bad option. Certainly that's what I do with all my portable drives that see any kind of regular updates. (It also has the benefit that I don't have to worry about drivers for the file system on any system I might plug it into.)

Ewen

Optimizing Linux with cheap flash drives

Posted Feb 20, 2011 14:11 UTC (Sun) by Oddscurity (guest, #46851) [Link]

Thanks for the comprehensive answer.

I may as well switch to just FAT32 for part of the use cases and the other ones are dominated by reads, so can stay on ext.

Optimizing Linux with cheap flash drives

Posted Nov 21, 2016 9:10 UTC (Mon) by Hi-Angel (guest, #110915) [Link]

I disagree, I think the best one can do is to dump offsets/cluster sizes that in use by the original FAT, and then to use them for formatting in a EXT. More over, one need to do it even for no intention of usage with other FS than FAT — because upon reformatting it's easy to get offsets wrong.

I'm wondering btw, why didn't the article have a chapter about finding out those sizes from the original FS. Last time I searched (½year ago), I only found people trying out timing attacks to the stick for that kind of things, though getting info for FS just after the stick bought would be way simpler. I'll check it out, perhaps below in comments someone mentioned it.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds