[General Questions and Answers] v6ak:
Goal:

Motivation: As my phone (Sony Ericsson SK17i) has low internal memory, it is essential to have a good MicroSD card with sd-ext and move some parts of /data to /sd-ext.

Problem: I am not satisfied with random I/O performance on ext4.

I, however, don't want to sacrify safety by disabling journaling.

My HW&SW:

My MicroSD: Samsung EVO MB-MP32D/EU, 32GB.

My phone: Sony Ericsson Xperia Mini Pro (SK17i)

ROM: LegacyXperia CM11

Ext4 mount options: noatime,nodiratime,barrier=1

My laptop OS (I ran mkfs.ext4, GParted and fdisk tools there): Ubuntu 12.04, up-to-date

Before making any change, I did a byte-by-byte backup of the original raw data, that is roughly dd if=/dev/sdc bytes=(some size) | compression > output_file. If you are interested in it, you can download the https://public.v6ak.com/samsung-evo-MB-MP32D--EU--32GB/sdc.gz.bz2 (< 1KiB) backup file.

What and why I did:

First, I resized the FAT32 (without reformatting) to 20GiB by GParted,

Second, I determined the sdcard characteristics by flashbench tool using command sudo ./flashbench -a /dev/sdc --blocksize=1024: https://public.v6ak.com/samsung-evo-MB-MP32D--EU--32GB/

There is my conclusion:

erase_block = 16777216
multi_plane = 16384
page = 8192

So, I took recommendation from https://wiki.gentoo.org/wiki/SDCard#Solution_2:_Tuned_ext4:

filesystem_block = min(page, 4096) = 4096 # Values higher than 4096 are not supported, so I had to pick 4096.
stride = multi_plane / page = 2 # Should I use page, or filesystem_block?
stripe_width = erase_block / page = 2048 # Should I use page, or filesystem_block?
# The resulting command:
sudo mkfs.ext4 -E stride=2,stripe-width=2048 -b 4096 /dev/sdc2

Third, I made another partitions in the free space. Now, I am just interested in the /dev/sdc2, which is sd-ext. The start of all the partitions is divisible by 8192, so I hope they are all properly aligned:

Disk /dev/sdc: 32.0 GB, 32010928128 bytes
255 heads, 63 sectors/track, 3891 cylinders, total 62521344 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000cf13

Device Boot Start End Blocks Id System
/dev/sdc1 8192 41951231 20971520 c W95 FAT32 (LBA) # The original partition
/dev/sdc2 41951232 50339839 4194304 83 Linux # The sd-ext partition
/dev/sdc3 50339840 52436991 1048576 83 Linux # A legacy partition, nothing important
/dev/sdc4 52436992 56631295 2097152 b W95 FAT32 # Titanium Backup partition, not important at the moment

The results:

I used A1 SD Bench to benchmark both FAT32 (i.e. /dev/sdc1) and ext4 (i.e. /dev/sdc2) filesystems. I did just the random I/O test when phone was in airplane mode (=> no noise from network events) and charging:

I've seen some suggestions it should perform several times better: http://forums.storagereview.com/index.php/topic/36678-samsung-evo-sd-memory-card-review-discussion/?p=287587 (Well, SD and microSD might differ, but I hope it not to differ much.)

There are my questions:

* Why is random write performance on the original FS significantly lower than on the benchmark above?

* Random writes are about twice faster on FAT32 than on ext4. Is it caused just by journaling?

* Why is random read significantly better on FAT32 than on ext4?

* Did I choose the right stripe/stride/blocksize? Should I double them?

* Should I perform another benchmark?

P.S.: Sorry there are no hyperlinks, I am not allowed to post them. I've tried to make the references as friendly as possible.