Mounting UBIFS images with a min. I/O unit of 1 byte

Artem Bityutskiy dedekind1 at gmail.com
Mon Mar 30 23:27:52 PDT 2015


Hi Matt,

On Mon, 2015-03-30 at 18:13 +0000, Kline, Matthew wrote:
> Hello all,
> 
> I am attempting to mount a UBIFS image to extract and inspect the files within.
> Unfortunately, I'm running into a bunch of problems. For starters, there doesn't
> seem to be a canonical way to do so - the process listed at
> http://www.linux-mtd.infradead.org/faq/ubifs.html#L_ubifs_extract
> seems out of date given how my kernel (3.19.2) behaves and compared to processes
> listed at more recent sources such as
> http://elinux.org/UBIFS#Mounting_UBI_Image_on_PC_using_nandsim or
> https://gist.github.com/naodesu/10620506. At any rate, I have had the most luck
> with the third method, but mount fails, logging to dmesg,
> "validate_sb: min. I/O unit mismatch: 8 in superblock, 2048 real".

Right, there is no canonical way, unfortunately, no one created it.

> After asking around on the IRC channel #mtd, I understand that the
> problem is caused by the UBIFS image being byte-addressable
> (with mkfs.ubifs being passed -m 1), while the NAND device nandsim is simulating
> is addressable to 2048 bit (or byte?) blocks (hence the dmesg output).

8 is what UBI/UBIFS uses in case of NOR flashes. So you seem to have an
image made for a NOR flash and you are trying to put it to a NAND flash
simulator.

> So, if the image has a minimum I/O unit of 1 byte and most NAND memory
> has a unit of >= 512 bytes
> (as mentioned at http://linux-mtd.infradead.org/doc/ubi.html#L_min_io_unit),
> is mounting it with nandsim out of the question? Is there any other approach
> I can take?

Try mtdram - should help. Make sure it is built, then modprobe mtdram.
There are parameters to control eraseblock size and flash size.

Generally - UBI/UBIFS images are specific to flash geometry. If you want
to mount the image, you need to have a flash of the same geometry:
eraseblock size and min. I/O unit size. Flash size should be same or
larger.

HTH.

P.S: feel free to amend the mtd web site too. Send patches against the
'mtd-www.git' project.





More information about the linux-mtd mailing list