Is my erase block size correct?

Russell Zuck rzuck at cincinnatitechnologies.com
Tue Jul 24 12:05:45 EDT 2012


I am attempting to troubleshoot an issue where my UBIFS becomes 
corrupted after repeated upgrade attempts.  Before I submit a bug report 
to the list, I'm attempting to rule out as many possibilities as I can.

While rechecking the datasheet for our NAND flash (Micron MT29F4G08BABWP 
4Gb), I noticed a discrepancy between the erase block size presented in 
the datasheet (128KiB + 4KiB) and that returned from mtdinfo (see 
below).  The extra 4KiB overhead is due to a 64Byte overhead for each of 
the 64 pages/block.

root at ctc-imx51 ~$ mtdinfo -a
Count of MTD devices:           4
Present MTD devices:            mtd0, mtd1, mtd2, mtd3
Sysfs interface supported:      yes

mtd0
Name:                           nor_flash
Type:                           dataflash
Eraseblock size:                512 bytes
Amount of eraseblocks:          8192 (4194304 bytes, 4.0 MiB)
Minimum input/output unit size: 512 bytes
Sub-page size:                  512 bytes
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

mtd1
Name:                           nand.bootloader
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          8 (1048576 bytes, 1024.0 KiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:2
Bad blocks are allowed:         true
Device is writable:             true

mtd2
Name:                           nand.kernel
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          24 (3145728 bytes, 3.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:4
Bad blocks are allowed:         true
Device is writable:             true

mtd3
Name:                           nand.rootfs
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          4064 (532676608 bytes, 508.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:6
Bad blocks are allowed:         true
Device is writable:             true

I've dug into the kernel source a bit and have come to the conclusion 
that the erase block size reported by mtdinfo comes from an 
interrogation of the MTD device by its driver.  I take this to mean that 
either I'm using the wrong driver, the driver is configured incorrectly, 
or the driver is correct and is not reporting the 4KiB overhead of each 
erase block.

Any help in confirming or refuting any of my 3 possible conclusions 
would be greatly appreciated.  Alternate theories are, of course, welcome.

Best regards,

Russell Zuck




More information about the linux-mtd mailing list