惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
爱范儿
爱范儿
博客园 - 【当耐特】
雷峰网
雷峰网
S
SegmentFault 最新的问题
美团技术团队
Blog — PlanetScale
Blog — PlanetScale
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
J
Java Code Geeks

博客园 - sudochen

ipq95xx rdp433 烧写运行openwrt25 git多用户管理 以太网EthernetII,LLC,SNAP判断 命令行获取公网IP地址 免密SSH登录Openwrt 研发管理的一般流程 haserl repo error with python3.10 on ubuntu22.04 京东AX3000后裔刷机 UTF-8 ebtables Ubuntu建立samba共享目录 linux文件的时间 IP优先级TOSDSCP SFP光模块定义 i2ctools工具使用 linux内核Makefile和busybox编译 I2C协议 SPI协议 免费ARP FEM介绍 notepad++每两个字符添加一个空格
linux kernel format nand for ubifs
sudochen · 2026-09-02 · via 博客园 - sudochen
root@AP148:~# ubidetach -p /dev/mtd0
root@AP148:~# ubiformat /dev/mtd0
ubiformat: mtd0 (nand), size 134217728 bytes (128.0 MiB), 1024 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1023 -- 100 % complete  
ubiformat: 1024 eraseblocks have valid erase counter, mean value is 0
ubiformat: formatting eraseblock 1023 -- 100 % complete  
root@AP148:~# ubiattach -p /dev/mtd0
UBI device number 0, total 1024 LEBs (130023424 bytes, 124.0 MiB), available 980 LEBs (124436480 bytes, 118.7 MiB), LEB size 126976 bytes (124.0 KiB)
root@AP148:~# ubin
ubinfo   ubinize
root@AP148:~# ubinfo /dev/u
ubi0      ubi_ctrl  urandom
root@AP148:~# ubinfo /dev/u
ubi0      ubi_ctrl  urandom
root@AP148:~# ubinfo /dev/ubi0
ubi0
Volumes count:                           0
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1024 (130023424 bytes, 124.0 MiB)
Amount of available logical eraseblocks: 980 (124436480 bytes, 118.7 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  40
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            249:0
root@AP148:~# ubimkvol --help
ubimkvol version 1.5.2 - a tool to create UBI volumes.

Usage: ubimkvol <UBI device node file name> [-h] [-a <alignment>] [-n <volume ID>] [-N <name>]
                        [-s <bytes>] [-S <LEBs>] [-t <static|dynamic>] [-V] [-m]
                        [--alignment=<alignment>][--vol_id=<volume ID>] [--name=<name>]
                        [--size=<bytes>] [--lebs=<LEBs>] [--type=<static|dynamic>] [--help]
                        [--version] [--maxavsize]

Example: ubimkvol /dev/ubi0 -s 20MiB -N config_data - create a 20 Megabytes volume
         named "config_data" on UBI device /dev/ubi0.

-a, --alignment=<alignment>   volume alignment (default is 1)
-n, --vol_id=<volume ID>      UBI volume ID, if not specified, the volume ID
                              will be assigned automatically
-N, --name=<name>             volume name
-s, --size=<bytes>            volume size volume size in bytes, kilobytes (KiB)
                              or megabytes (MiB)
-S, --lebs=<LEBs count>       alternative way to give volume size in logical
                              eraseblocks
-m, --maxavsize               set volume size to maximum available size
-t, --type=<static|dynamic>   volume type (dynamic, static), default is dynamic
-h, -?, --help                print help message
-V, --version                 print program version
root@AP148:~# ubimkvol /dev/ubi0 -N kernel -m 100M
ubimkvol: error!: more then one UBI device specified (use -h for help)
root@AP148:~# ubimkvol /dev/ubi0 -N kernel -s 100M
bad size specifier: "M" - should be 'KiB', 'MiB' or 'GiB'
ubimkvol: error!: bad volume size: "100M"
root@AP148:~# ubimkvol /dev/ubi0 -N kernel -s 100MiB
Volume ID 0, size 826 LEBs (104882176 bytes, 100.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "kernel", alignment 1
root@AP148:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 19554304
Volume ID 1, size 154 LEBs (19554304 bytes, 18.6 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
root@AP148:~# ubinfo /dev/
console             loop5               mtd12ro             mtd6                mtdblock12          network_throughput  ttyS0
cpu_dma_latency     loop6               mtd13               mtd6ro              mtdblock13          null                ttyS1
full                loop7               mtd13ro             mtd7                mtdblock2           port                ubi0
hwrng               memory_bandwidth    mtd1ro              mtd7ro              mtdblock3           ppp                 ubi0_0
kmsg                mtd0                mtd2                mtd8                mtdblock4           ptmx                ubi0_1
log                 mtd0ro              mtd2ro              mtd8ro              mtdblock5           ptp0                ubi_ctrl
loop-control        mtd1                mtd3                mtd9                mtdblock6           ptp1                urandom
loop0               mtd10               mtd3ro              mtd9ro              mtdblock7           pts/                watchdog
loop1               mtd10ro             mtd4                mtdblock0           mtdblock8           random              watchdog0
loop2               mtd11               mtd4ro              mtdblock1           mtdblock9           shm/                zero
loop3               mtd11ro             mtd5                mtdblock10          net/                tty
loop4               mtd12               mtd5ro              mtdblock11          network_latency     ttyMSM0
root@AP148:~# ubinfo /dev/ubi0
ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1024 (130023424 bytes, 124.0 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:  40
Current maximum erase counter value:     3
Minimum input/output unit size:          2048 bytes
Character device major/minor:            249:0
Present volumes:                         0, 1
root@AP148:~# ls /dev/ubi
ubi0      ubi0_0    ubi0_1    ubi_ctrl
root@AP148:~# ls /dev/ubi
ubi0      ubi0_0    ubi0_1    ubi_ctrl
root@AP148:~# ls /dev/ubi
root@AP148:~# mount -t ubifs /dev/ubi0_1 /mnt/
root@AP148:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 9472      9472         0 100% /rom
tmpfs                   240248       104    240144   0% /tmp
/dev/mtdblock13          15296       592     14704   4% /overlay
overlayfs:/overlay       15296       592     14704   4% /
tmpfs                      512         0       512   0% /dev
/dev/ubi0_1              15824        20     14960   0% /mnt
root@AP148:~# cd /mnt/
root@AP148:/mnt# ls
root@AP148:/mnt# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 9.3M      9.3M         0 100% /rom
tmpfs                   234.6M    104.0K    234.5M   0% /tmp
/dev/mtdblock13          14.9M    592.0K     14.4M   4% /overlay
overlayfs:/overlay       14.9M    592.0K     14.4M   4% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/ubi0_1              15.5M     20.0K     14.6M   0% /mnt