Home Forum Developers General discussions [SOLVED] How to create new Ubifs partition?

JRPassphrase Registration Control

In order to register on this site, you must first submit the passphrase below.

TODO list for each hardware target can be found as sticky topic in the corresponding forum


Gilles
useravatar
User Info

[SOLVED] How to create new Ubifs partition?

Hello

After messing with Jffs2 on the Atcom IP01, it turns out that I should use Ubifs instead to format the mtd2 partition on the NAND (mtd0 = root fs in RAM, mtd1 = kernel).

So I followed the Unsorted Block Image File System (UBIFS) document in the Blackfin wiki, but get the following error after successfully running "ubiformat /dev/mtd4 -s 512 -O 512":

Code:

ip01> ls -al /dev/ub*

crw-r--r--    1 root     root      253,   0 May 27  2011 /dev/ubi0
crw-r--r--    1 root     root       10,  63 May 27  2011 /dev/ubi_ctrl
ip01>
ip01> 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: 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:     0
UBI: available PEBs:             1961
UBI: total number of reserved PEBs: 23
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 1/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 46
UBI device number 0, total 1984 LEBs (255983616 bytes, 244.1 MiB), available 1961 LEBs (253016064 bytes, 241.3 MiB), LEB size 129024 bytes (126.0 KiB)
ip01>
ip01> ubimkvol /dev/ubi0 -s 20MiB -N ubifs0
libubi: error!: "/dev/ubi0" has major:minor 253:0, but this does not correspond to any UBI device or volume
ubimkvol: error!: "/dev/ubi0" is not an UBI device node
ip01>

Does someone know what is causing that error?

Thank you.



Edited By:  Gilles
Jun-10-11 15:31:36

Administrator has disabled public posting
admin
useravatar
User Info

Re: [SOLVED] How to create new Ubifs partition?

Hi Gilles,

It seems your /dev/ubi0 is not in sync with the sysfs.
Check what major:minor report by ybiinfo and make a corresponding nod in /dev/

Cheers
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: [SOLVED] How to create new Ubifs partition?

Thanks Dimitar. I actually used the device_table.txt from Switchfin, and uncommented the two relevant lines:

Code:


#UBIFS nodes
/dev/ubi_ctrl    c    644    0    0    10    63    0    0    -
/dev/ubi0    c    644    0    0    253    0    0    0    -

Does it mean that Switchfin uses mdev + device_table-min.txt and creates device nodes at run-time?


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: [SOLVED] How to create new Ubifs partition?

I'm getting closed. Using mdev + dynamic dev nodes, I'm getting all the way to "ubimkvol /dev/ubi0 -m -N ubifs0", which stops with error "UBI device does not have free logical eraseblocks".

It looks like I'm using wrong settings, but I don't know what to use in mkfs.ubifs, ubinize, the MTD partition, and ubiformat.

On workstation

Code:


# /usr/src/uClinux-dist-2010R1-RC5/user/mtd-utils/mkfs.ubifs --squash-uids -m 2048 -e 204800 -c 1024 -d /usr/src/uClinux-dist-2010R1-RC5/romfs -D device_table-min.txt -o /usr/src/uClinux-dist-2010R1-RC5/images/rootfs.ubifs

# vi ubi.cfg
[ubifs]
mode=ubi
image=./images/rootfs.ubifs
vol_id=0
#vol_size field must be larger than UBIFS image,
#but smaller than total flash space
;4.915.200 images/rootfs.ubifs
;
;mtd2: 0f800000 00020000 "file system(nand)"
;f800000 = 260.046.848
vol_size=200MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

# ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubi.cfg

# mv ubi.img /var/www/

On Atcom

Code:


# wget -c http://workstation/ubi.img

# ubiformat /dev/mtd2 -s 512 -f ubi.img
           
> 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 -m -N ubifs0
ubimkvol: error!: UBI device does not have free logical eraseblocks

Any help appreciated.


Administrator has disabled public posting
admin
useravatar
User Info

Re: [SOLVED] How to create new Ubifs partition?

Hi Gilles,

Probably you can just get the latest Switchfin SVN trunk and test on your IP01.
It should work now.

Best Regards
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: [SOLVED] How to create new Ubifs partition?

Problem solved. Make sure you use the right settings for mkfs.ubifs, leave enough room in ubi.cfg.

I guess mdev is only needed when mouting a Ubifs partition manually, ie. not when booting.

I don't know what ubimkvol is for.


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 2583  Total Topics: 291  Total Polls: 1  Total Posts: 1725  Total Posts Today: 1
User Info:   Newest User :  ZS6GDM   Members Online: 0   Guests Online: 49
Online  There are no members online
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked