Is ubiattach alone somehow damaging a partition?

Richard Weinberger richard at nod.at
Wed Mar 9 13:00:14 PST 2016


Am 09.03.2016 um 21:52 schrieb john smith:
> On 3/9/16, Richard Weinberger <richard.weinberger at gmail.com> wrote:
>> Are both mtd1 and mtd2 supposed to carry UBI?
>> I'm not rally sure what you are trying to do...
> 
> Hmm... probably not as kernel booting command does not contain
> anything similar to this:
> 
> root=ubi:rootfs rootfstype=ubifs ubi.mtd=flash1.rootfs0
> 
> However, I just thought that I can use ubiattach to be able to mount
> any given mtd device.  I was looking for a way to get access to a
> currently not used mtd device.  If ubiattach is suitable for this,
> then what may be?
> 
>> If you ask UBI to attach to an mtd it will write to it.
> 
> Where exactly?  In do_attach() there is only open(), ioctl() and
> close() called.  Where will writing take place?

We need to clarify some bits first.
UBI is kind of a volume manager on top of MTD. It offers also wear leveling
and other NAND related stuff.
Think of an LVM for flash.
Attaching and MTD to UBI means instantiating UBI and making the data
stored by UBI available.
UBI volumes can be used by high level users. The most prominent user is UBIFS.
A filesystem on top of UBI.

If you attach an MTD, UBI owns it and is obligated to write the metadata and/or
erase blocks.
For the gory details see drivers/mtd/ubi/attach.c.

So, what exactly is the expected result and what happens?
I'm still not sure what you are trying to do.

Thanks,
//richard



More information about the linux-mtd mailing list