挂载ubifs文件系统分区

来源:互联网 发布:阜宁县网络发言人平台 编辑:程序博客网 时间:2024/05/16 17:51

闲着没事玩玩ubifs

需要的资料可以到这个网站查询:http://www.linux-mtd.infradead.org/faq/ubifs.html

1.格式化:              ./ubiformat /dev/mtd4

2.创建ubi0节点:    ubiattach /dev/ubi_ctrl -m 4

3.创建分区标识:    ubimkvol /dev/ubi0 -N rfs -s 81920

    发现这里出错了,I get: "init_constants_early: too few LEBs (12), min. is 17"

    查了一下-s后边是byte,81920太小了,才10k,果断改大点 改成10m=10240*1024*8=83886080

4.挂载:                 mount -t ubifs ubi0:rfs /mnt

测试:

创建测试文件:

重启

Please press Enter to activate this console.
[root@EmbedSky /]#
[root@EmbedSky /]# mount -t ubifs ubi0:rfsaa /home/haha (需要重新生成dev)
UBIFS error (pid 1613): ubifs_mount: cannot open "ubi0:rfsaa", error -19
mount: mounting ubi0:rfsaa on /home/haha failed: No such device
[root@EmbedSky /]# ubimkvol /dev/ubi0 -N rfsaa -s 83886080 (这一步其实不需要了)
ubimkvol: can't open '/dev/ubi0': No such file or directory
[root@EmbedSky /]# ubiattach /dev/ubi_ctrl -m 4(生成dev)
UBI: attaching mtd4 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: max. sequence number:       14
UBI: attached mtd4 to ubi0
UBI: MTD device name:            "USER1"
UBI: MTD device size:            384 MiB
UBI: number of good PEBs:        3072
UBI: number of bad PEBs:         0
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     3
UBI: available PEBs:             2379
UBI: total number of reserved PEBs: 693
UBI: number of PEBs reserved for bad PEB handling: 30
UBI: max/mean erase counter: 3/1
UBI: image sequence number:  504227540
UBI: background thread "ubi_bgt0d" started, PID 1620
[root@EmbedSky /]# ubimkvol /dev/ubi0 -N rfs -s 83886080
UBI error: ubi_create_volume: cannot create volume 3, error -17
ubimkvol: UBI_IOCMKVOL: File exists
[root@EmbedSky /]# ubimkvol /dev/ubi0 -N rfsaa -s 83886080
UBI error: ubi_create_volume: cannot create volume 3, error -17
ubimkvol: UBI_IOCMKVOL: File exists
[root@EmbedSky /]# mount -t ubifs ubi0:rfsaa /home/haha
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 2, name "rfsaa"
UBIFS: file system size:   82575360 bytes (80640 KiB, 78 MiB, 640 LEBs)
UBIFS: journal size:       4128768 bytes (4032 KiB, 3 MiB, 32 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  3900238 bytes (3808 KiB)
[root@EmbedSky /]# cd /home
[root@EmbedSky /home]# ls
1                            hh
TQ210                        hong.c
adc                          hong.c~
adc.c                        jpeg.tar.gz
adcs.c                       led (copy).c~
adcs.c~                      led.c
arm-linux                    led.c~
beep                         led1
beep.c                       led2
beep.c~                      mjpg-streamer-r63
cap.c                        rootfs_linux_v1.4_CoreB.bin
cap.c~                       sky
capture01.jpg                test-mmap.jpg
ds18                         test.bin
ds18b20                      test2
[root@EmbedSky /home]# cd haha
[root@EmbedSky haha]# ls(创建的文件还在,挂载成功)
haha.txt
[root@EmbedSky haha]#





0 0
原创粉丝点击