[U-Boot] Unreadable UBIFS partition after power cuts

Bill Pringlemeir bpringlemeir at nbsps.com
Fri Jan 16 16:42:20 CET 2015


On 16 Jan 2015, Anton.Habegger at delta-es.com wrote:

> What does a "dangling branch" and "dangling match" mean? Are those
> situations handled differently under U-Boot?

... I don't know about this.  However, it is easy to think that the
issue is with the UbiFs layer as it doesn't mount.  However, it can be
several layer; the MTD driver, MTD, UBI and UbiFS.  I guess you have
some raw image captured?  If you have a raw NAND image you can try
different analysis.

Here is a nandsim mount to emulate on a PC.

# nandsim with Micron 3.3V 256MiB, 2048 bytes page.
modprobe nandsim first_id_byte=0x2c second_id_byte=0xda third_id_byte=0x90 fourth_id_byte=0x95 parts=2,64,64
flash_erase /dev/mtd3 0 0
ubiformat /dev/mtd3 -f rootfs.ubi  # rootfs.ubi is the flash dump
#modprobe ubi mtd=3
#mount -t ubifs -o ro /dev/ubi0_3 /mnt/ubifs

You can put the flash id sequence for your boards flash in the 'id_byte'
and setup different partitions to emulate your actual device (ie, your
parts=... is different).

The last two lines will mount the partition using the Linux PC code.


Grab 'git://git.infradead.org/mtd-utils.git'.  There is a file in
ubi-utils called ubinfo.c and it maybe helpful.  Also, hujian yang has
been trying to get a 'ubidump' program merged to mtd-utils.

See:
 http://lists.infradead.org/pipermail/linux-mtd/2014-December/056828.html
 http://lists.infradead.org/pipermail/linux-mtd/2014-December/056829.html

and many others.  The program might be helpful.  I think there aren't
functional issue with the current patches, but structural issues
(fitting with mtd-utils).

In this message I attached a much simpler parser of just the UBI layer
(this is really dumb, but should be easy to modify).

 http://lists.infradead.org/pipermail/linux-mtd/2014-July/054712.html

They might be useful to identify injured blocks/pages.  Obviously, the
'recovery needed' shows that fixing some partial write/erase is the
issue.  If UBI passes a damaged page/info to UbiFS, then it will act on
bad info.

Fwiw,
Bill Pringlemeir.


More information about the U-Boot mailing list