You can get the erase block size from SD cards - it's in the Card Specific Data structure - but I don't know of any standard way to get it for USB mass storage devices.
Sascha Silbe wrote: > On Sat, Oct 10, 2009 at 02:46:17AM +0100, Martin Dengler wrote: > >> Nope (SoaS) - that'll waste your partition table in favour of whatever >> I copied from my dsd-inspired "make-fake-device" partition table >> script[1]. I'd love patches. > From that script: >> NUM_HEADS=16 >> NUM_SECTORS_PER_TRACK=62 > > That means 16KB alignment (16*62*512/16384 = 31) which is most likely > smaller than the erase block size on flash storage >= 1GB. > > >> Do this for ext3 (omit -j for ext2): >> >> fdisk -H 224 -S 56 /dev/sdb > That's already a bit better (128KB alignment) and more or less as good > as you can get for ext3 (the Journal seems to be only 128KB-aligned > and even for that you need a recent enough mke2fs). > Unfortunately there's no real way to find out the erase block size > (other than being a really big customer and getting access to real > data sheets), but my guess would be that 128KB might be enough for 1GB > flash, but might not e.g. for my 16GB one. The upper limit for the > latter is 4MB (total size is an odd multiple of 4MB), so that's what I > used for alignment of all on-disk structures (as far as possible). > By using 128 heads (-H 128) and 32 sectors/track (-S 32) you get 2MB > alignment and can even increase it further by choosing appropriate > cluster numbers. Watch out for the numbering: it seems to be 1-based, > so to get 4MB alignment you need to use _odd_ cluster numbers as > starting position. I also had the impression that fdisk uses > salesman-MB, so better enter cylinder numbers instead (number of > cylinders = size-in-MB/2). > >> mke2fs -j -E stripe-width=32,resize=500G /dev/sdb1 > That gives you 128KB again (because block size is 4KB). I went with > stripe-width=1024 instead to get 4MB alignment. Doesn't work for the > Journal, of course. > Would be good to know whether ext4 does proper alignment of the journal. > > CU Sascha > _______________________________________________ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel