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.

  • "however there is the issue of wear leveling" -- You really do not have a choice in the matter. Either the USB Flash drive or SDcard you buy does a satisfactory job of wear-leveling or it doesn't. You cannot/shouldn't use a filesystem that does wear-leveling (e.g. JFFS2). And you cannot install UBI volume management (you would need to install MTD first, but that is for raw Flash devices). So you are stuck with relying on the embedded controller.
    – sawdust
    Sep 11, 2014 at 6:26

3 Answers 3


Don't worry about cylinders, heads and sectors and only ever work with sectors. The easiest way to align the filesystem is to simply not have a partition table (i.e. create the filesystem on /dev/sdX directly). Most Linux systems will handle this fine, but Windows will freak out and you also won't be able to make it bootable. If you need a partition table, work out how many 512 byte sectors make up an erase block. Erase blocks are around 128-512KiB so if you can't find out what your flash drive uses go with 1024 sectors. Make sure that partitions start on a multiple of this number.

You also want to tell ext2/3/4 about the erase block size so it can avoid unnecessarily modifying blocks. Set both stride and stripe-width to the number of filesystem blocks which make up an erase block, so working on a 512KiB erase block use the following:

mkfs.ext4 -b 4096 -E stride=128,stripe-width=128

In terms of performance, not having a journal should improve performance (but increase the chance of data corruption if operation is interrupted). However, ext4's extents should improve performance because less metadata needs to be modified for large files. I would probably use ext4 with the journal disabled:

tune2fs -O ^has_journal
  • You can use cat /proc/mtd to find out erase block sizes for attached flash devices.
    – Tomalak
    Aug 30, 2013 at 5:35
  • Flash drives without partition table should work fine on Windows as long as the filesystem is supported. Pendrives usually don't have partition table out of the box and they work fine.
    – gronostaj
    Jan 12, 2014 at 11:37
  • Optimizing fs on sd-card for Linux/Fedora on Dreamplug shows how to let ext4 "know" the erase blocks size and set its block size and “stride” value accordingly. Also I believe /proc/mtd is not relevant here since it's available only for raw flash devices as sawdust said, not for SD/stick flash memory devices.
    – tuk0z
    Sep 1, 2015 at 16:52
  • Tried that, it was a terribly bad advice. Do not use those parameters with a USB flash drive. blogofterje.wordpress.com/2012/01/14/optimizing-fs-on-sd-card - this guy has better parameters, but it's still only marginally better, if at all, than what gparted uses by default.
    – Zdenek
    May 21, 2016 at 11:45
  • That's the same link I gave in September ^^ Correct about parted/Gparted AFAIK.
    – tuk0z
    Jul 14, 2017 at 11:43

These days most Linux partitioning and filesystem creation tools default to values that align data on 4K boundaries and will even use the underlying block size if the disk exposes it so things aren't quite as bad as in the LWN article:

TLDR; When using a modern Linux distro (say 2013 or later) with recent versions of tools to create your partitions and filesystems better (but not perfect) alignment will happen automatically. Also take care - the very best values for an SD card may be different to that for a USB stick (I believe your Transcend JetFlash is a USB stick not an SD Card). You would have to benchmark to deduce the true underlying erase block size on cheap flash...


Also, in your fstab, be sure to use the mount option "noatime" to avoid unnecessary writes every time a file is accessed.

  • Still true to this day and this reminded me that this option was missing XD Thx
    – HypeWolf
    Oct 9, 2019 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.