How to correctly partition usb flash drive and which filesystem to choose considering wear leveling?

Posted by random1 on Super User See other posts from Super User or by random1
Published on 2012-01-16T17:24:39Z Indexed on 2012/03/26 5:32 UTC
Read the original article Hit count: 503

Two problems. First one: how to partition the flash drive?

I shouldn't need to do this, but I'm no longer sure if my partition is properly aligned since I was forced to delete and create a new partition table after gparted complained when I tried to format the drive from FAT to ext4.

The naive answer would be to say "just use default and everything is going to be alright". However if you read the following links you'll know things are not that simple: https://lwn.net/Articles/428584/ and http://linux-howto-guide.blogspot.com/2009/10/increase-usb-flash-drive-write-speed.html

Then there is also the issue of cylinders, heads and sectors. Currently I get this:

$sfdisk -l -uM  /dev/sdd
Disk /dev/sdd: 30147 cylinders, 64 heads, 32 sectors/track
Warning: The partition table looks like it was made
   for C/H/S=*/255/63 (instead of 30147/64/32).
For this listing I'll assume that geometry.
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdd1         1  30146  30146   30869504   83  Linux

$fdisk -l /dev/sdd
Disk /dev/sdd: 31.6 GB, 31611420672 bytes
255 heads, 63 sectors/track, 3843 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00010c28

So from my current understanding I should align partitions at 4 MiB (currently it's at 1 MiB). But I still don't know how to set the heads and sectors properly for my device.

Second problem: file system.

From the benchmarks I saw ext4 provides the best performance, however there is the issue of wear leveling. How can I know that my Transcend JetFlash 700's microcontroller provides for wear leveling? Or will I just be killing my drive faster?

I've seen a lot of posts on the web saying don't worry the newer drives already take care of that. But I've never seen a single piece of backed evidence of that and at some point people start mixing SSD with USB flash drives technology. The safe option would be to go for ext2, however a serious of tests that I performed showed horrible performance!!!

These values are from a real scenario and not some synthetic test:

42 files: 3,429,415,284 bytes copied to flash drive
original fat32: 15.1 MiB/s
ext4 after new partition table: 10.2 MiB/s
ext2 after new partition table:  1.9 MiB/s

Please read the links that I posted above before answering. I would also be interested in answers backed up with some references because a lot is said and re-said but then it lacks facts.

Thank you for the help.

© Super User or respective owner

Related posts about linux

Related posts about partitioning