• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: "UBI device does not have free logical eraseblocks"?  (Read 5794 times)
littlebigman
Newbie
*

Karma: 0
Posts: 40


View Profile
« on: May 31, 2011, 05:53:19 AM »

Hello

I'm quite new to embedded Linux, and don't know how to compile a Ubifs root filesystem + Ubi volume so that it'll work on a 256MiB NAND flash with 248 MiB available in the second partition to hold the root filesystem.

Here's what I used:

On the workstation
Code:
# mkfs.ubifs -v --squash-uids -m 2048 -e 204800 -c 1024 -d ./romfs -D ./vendors/mfg/board/device_table-min.txt -o ./images/rootfs.ubifs

On the appliance
Code:
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00800000 00001000 "ROMfs"
mtd1: 00800000 00020000 "linux kernel(nand)"
mtd2: 0f800000 00020000 "file system(nand)"

# 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: volume 0 ("rootfs") re-sized from 1626 to 1961 LEBs
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "file system(nand)"
UBI: MTD device size:            248 MiB
UBI: number of good PEBs:        1984
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1984
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 10/5
UBI: image sequence number: 364645537
mtd: Giving out device 3 to rootfs
UBI: background thread "ubi_bgt0d" started, PID 69
UBI device number 0, total 1984 LEBs (255983616 bytes, 244.1 MiB), available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)

# mdev -s

# ubinfo /dev/ubi0 -a
ubi0:
Volumes count:                           1
Logical eraseblock size:                 129024
Total amount of logical eraseblocks:     1984 (255983616 bytes, 244.1 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  19
Current maximum erase counter value:     11
Minimum input/output unit size:          2048 bytes
Character device major/minor:            251:0
Present volumes:                         0

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        1961 LEBs (253016064 bytes, 241.3 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 251:1

# ubimkvol /dev/ubi0 -N test --lebs=51
ubimkvol: error!: UBI device does not have free logical eraseblocks

Could someone tell me what numbers to use in mkfs.ubifs and ubimkvol so that I can proceed with "mount"?

Thank you.
Logged

littlebigman
Newbie
*

Karma: 0
Posts: 40


View Profile
« Reply #1 on: May 31, 2011, 06:57:24 AM »

Since no size-related settings are required to call ubiattach, it looks like the Makefile is using wrong settings when compiling the root filesystem using mkfs.ubifs:
Code:
-m 2048 -e 204800 -c 1024 -d
Logged

littlebigman
Newbie
*

Karma: 0
Posts: 40


View Profile
« Reply #2 on: June 01, 2011, 05:30:57 AM »

Yes, I suspect those numbers are wrong, but at this point, this is Greek to me Undecided
Logged

bnborg
Newbie
*

Karma: 0
Posts: 31


View Profile
« Reply #3 on: August 04, 2011, 05:36:50 PM »

It is normal for there to be no erase blocks when a ubifs takes up the whole mtd partition.  The numbers are in your ubinfo for /dev/ubi0.  You need:

mkfs.ubifs -m 2048 -e 129024 -c 1984 -r ./romfs ./images/rootfs.ubifs.

For my SheevaPlug, with 512 MB NAND, I used:

Code:
cp -ax . /opt/ubi
mkfs.ubifs -m 2048 -e 129024 -c 4053 -r /opt/ubi ubifs.img
ubiupdatevol /dev/ubi0_1 ubifs.img

My ubinfo:

Code:
root@debian:/# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           1
Logical eraseblock size:                 129024 bytes, 126.0 KiB
Total amount of logical eraseblocks:     4053 (522934272 bytes, 498.7 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       3
Count of reserved physical eraseblocks:  40
Current maximum erase counter value:     25
Minimum input/output unit size:          2048 bytes
Character device major/minor:            252:0
Present volumes:                         1

Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        4009 LEBs (517257216 bytes, 493.3 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 252:2
root@debian:/#
Logged

Pages: [1]
Print
Jump to: