Specifications
9.1.5.2. Using UBI on NAND Flash:
Erase the flash partition:
root@generic-armv5te:~# flash_erase -q /dev/mtd4 0 0
root@generic-armv5te:~#
and attach it to UBI:
root@generic-armv5te:~# ubiattach /dev/ubi_ctrl -m 4 -O 2048
[ 115.210000] UBI: attaching mtd4 to ubi0
[ 116.580000] UBI: scanning is finished
[ 116.590000] UBI: empty MTD device detected
[ 116.630000] UBI: attached mtd4 (name "filesystem", size 248 MiB) to ubi0
[ 116.630000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 116.650000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 116.650000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 116.660000] UBI: good PEBs: 1984, bad PEBs: 0, corrupted PEBs: 0
[ 116.670000] UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
[ 116.680000] UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1951905100
[ 116.690000] UBI: available PEBs: 1976, total reserved PEBs: 8, PEBs reserved for bad PEB handling: 4
[ 116.700000] UBI: background thread "ubi_bgt0d" started, PID 719
UBI device number 0, total 1984 LEBs (251920384 bytes, 240.2 MiB), available 1976 LEBs (250904576 bytes, 239.3 MiB), LEB size 126976 bytes (124.0 KiB)
root@generic-armv5te:~#
As this is done, we check if things are done correct:
root@generic-armv5te:~# ubinfo
UBI version: 1
Count of UBI devices: 1
UBI control device major/minor: 10:59
Present UBI devices: ubi0
root@generic-armv5te:~#
Create a Volume on the UBI Device:
root@generic-armv5te:~# ubimkvol /dev/ubi0 -N filesystem -m
Set volume size to 250904576
Volume ID 0, size 1976 LEBs (250904576 bytes, 239.3 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "filesystem", alignment 1
root@generic-armv5te:~#
As we intend to create just a single volume, we use maximum size ("-m" option).
Mount and use it:
root@generic-armv5te:~# mkdir /mnt/filesystem
root@generic-armv5te:~# mount -t ubifs /dev/ubi0_0 /mnt/filesystem
[ 126.720000] UBIFS: default file-system created
[ 126.720000] UBIFS: background thread "ubifs_bgt0_0" started, PID 726
[ 126.860000] UBIFS: mounted UBI device 0, volume 0, name "filesystem"(null)
[ 126.870000] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 126.880000] UBIFS: FS size: 249253888 bytes (237 MiB, 1963 LEBs), journal size 12443648 bytes (11 MiB, 98 LEBs)
[ 126.890000] UBIFS: reserved for root: 4952683 bytes (4836 KiB)
[ 126.900000] UBIFS: media format: w4/r0 (latest is w4/r0), UUID F5A040E7-EFDA-4732-A803-99C0066F2309, small LPT model
root@generic-armv5te:~#
Check with "-a" option:
root@generic-armv5te:~# ubinfo -a
UBI version: 1
Count of UBI devices: 1
UBI control device major/minor: 10:59
9.1.5.2. Using UBI on NAND Flash: 102