partitions and file system data need erase block alignment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro Image Tools |
Fix Released
|
Medium
|
Loïc Minier |
Bug Description
The linaro-media-create currently does not attempt to align partitions to erase blocks on flash media. This may be devastating to both performance and life expectancy of the media.
Instead, the script goes through a lot of effort to align the partition on logical cylinders, which is completely pointless on anything that does not run old versions of MS-DOS.
I'd recommend aligning all partitions to full megabytes using "sfdisk" instead of "fdisk".
Similarly, the mkfs.msdos tool should use hidden sectors to align the start of the ms-dos file system on an erase block boundary, and use a cluster size that is as large as possible without increasing the file system size too much.
When creating a btrfs root file system, the nodatasum and ssd mount options should be used to improve performance. We might add a warning when a user tries to create an ext3/ext4 file system on flash, since there is no way to make that perform or not wear out the flash.
We should probably allow using logfs as the root file system besides btrfs, since that is optimized a lot better for flash and consumes less storage space when using compression.
Note that even though flash vendors claim to have hardware wear levelling to make up for this, that is utter nonsense, even on industrial-grade compactflash cards it is basically useless and you have to do it in software.
Related branches
- Guilherme Salgado (community): Approve
-
Diff: 506 lines (+193/-60)5 files modifiedlinaro-media-create (+1/-1)
linaro_media_create/__init__.py (+4/-0)
linaro_media_create/boards.py (+104/-12)
linaro_media_create/partitions.py (+22/-15)
linaro_media_create/tests/test_media_create.py (+62/-32)
Changed in linaro-image-tools: | |
importance: | Undecided → Medium |
Changed in linaro-image-tools: | |
status: | New → Triaged |
Changed in linaro-image-tools: | |
assignee: | nobody → Loïc Minier (lool) |
status: | Triaged → In Progress |
Changed in linaro-image-tools: | |
status: | In Progress → Fix Committed |
Changed in linaro-image-tools: | |
status: | Fix Committed → Fix Released |
We just looked into the source and it appears that l-m-c currently calls sfdisk (linaro_ media_create/ partitions. py:create_ partitions) as following:
sfdisk -D -H <heads> -S <sectors> ',9,<fatid> ,*\n,,, -' <device>
sfdisk reads lines of the form:
<start> <size> <id> <bootable> <c,h,s> <c,h,s>
where each line fills one partition descriptor. So, the above command creates two partitions:
part1 (vfat):
,9,%s,*
| | | |
| | | +--- bootable
| | +----- id (set to fat)
| +-------- size (in cylinders)
+---------- start
part2 (ext):
,,,-
||||
|||+--- non bootable
||+---- id (defaults to linux)
|+----- size (everything)
+------ start
Which means that the second partition is cylinder aligned but we want it to be 4-meg aligned.