LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   [Ubifs] "vtbl_check: too large reserved_pebs" (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/%5Bubifs%5D-vtbl_check-too-large-reserved_pebs-885385/)

littlebigman 06-09-2011 06:46 AM

[Ubifs] "vtbl_check: too large reserved_pebs"
 
Hello

I went through the docs/FAQs on the MTD/UBI site and elsewhere, and proceeded to create a Ubifs root filesystem and flash a NAND partition with it.
However, "ubiattach" fails, so I guess I didn't use the right settings in mkfs.ubifs and/or ubinize and/or ubiformat for use with that NAND partition.

Here are the steps I took.

First, get infos about NAND
Code:

appliance:/> mtdinfo /dev/mtd2 -u
mtd2
Name:                          filesystem_nand
Type:                          nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          1984 (260046848 bytes, 248.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
Default UBI VID header offset:  512
Default UBI data offset:        2048
Default UBI LEB size:          129024 bytes, 126.0 KiB
Maximum UBI volumes count:      128

Next, cCreate root filesystem
Code:

ubuntu:/> mkfs.ubifs --squash-uids -m 2048 -e 131072 -c 1984 -d
./romfs -D device_table-min.txt -o ./images/rootfs.ubifs

Ubinize image
Code:

ubuntu:/> cat ubi.cfg
[ubifs]
mode=ubi
image=./images/rootfs.ubifs
vol_id=0
vol_size=248MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

ubuntu:/> ubinize -o rootfs.ubi.img -m 2048 -p 128KiB -s 512 ./ubi.cfg

On the appliance, format the partition on the NAND memory:
Code:

appliance:/> ubiformat /dev/mtd2 -s 512 -f rootfs.ubi.img
Finally, attach the MTD partition to Ubi before mounting it:
Code:

appliance:/> ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:  131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI error: vtbl_check: too large reserved_pebs 2016, good PEBs 1984
UBI error: vtbl_check: volume table check failed: record 0, error 9
UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22
ubiattach: error!: cannot attach mtd2
          error 22 (Invalid argument)

I assume I used one or more settings wrong, but I don't know which. Maybe I must leave some room for the journal + recovery data?

Thank you.

littlebigman 06-10-2011 07:25 AM

In case someone has the same problem... the solution is to...
  1. Edit the Makefile that runs mkfs.ubifs so that it uses the right setting for the "-e" option, which is computed by this formula:

    LEB_size = PEB_size - ((Subpage_size + Page_size)) / Page_size) * Page_size
    (In the division, keep the integer part)

    Also make sure you use the right setting for "-c" ("Amount of eraseblocks")
  2. In ubi.cfg, make sure you use a "vol_size" that's smaller than the actual size of the partition on the NAND to leave room for Ubifs internal data. With "vol_type=dynamic", Ubifs will end up using the whole space automatically


All times are GMT -5. The time now is 09:02 AM.