UBIFS

From postmarketOS

UBIFS is an unsorted block image file system. It works on top of UBI (erase block management layer) which itself works on top of memory technology device(MTD) layer.

To use UBIFS, one needs to set CONFIG_MTD_UBI kernel option as built-in or module.

How to mount UBIFS

Note To mount UBIFS it's required to have mtd-utils-ubi installed. Consider adding this package to makedepends of the device package, if the device uses UBIFS.

First, get list of all MTDs

$ cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00040000 "spl"
mtd1: 000c0000 00040000 "2ndbl"
mtd2: 00080000 00040000 "kpanic"
mtd3: 1fe80000 00040000 "ubipac"

Note that some of them cannot be used for mounting. In this case, only /dev/mtd3 can be used.

Next step is to attach UBI to an MTD.

If UBIFS support is built as module, it's possible to attach in this way:

# modprobe ubi mtd=3 mtd=5

Otherwise:

# ubiattach /dev/ubi_ctrl -m 3
UBI device number 0, total 2042 LEBs (518569984 bytes, 494.5 MiB), available 0 LEBs (0 bytes), LEB size 253952 bytes (248.0 KiB)

Now, create mount point and mount the wanted partition

# mkdir -p /mnt/ubifs
# mount -t ubifs ubi0:system /mnt/ubifs

When work with partition is over, unmount it and detach a device

# umount /mnt/ubifs
# ubidetach -m 3

Sources