Format Data Partition

From Qi-Hardware
(Redirected from Ubifs Startup)
Jump to: navigation, search

This short tutorial will guide you through the process of formating and mounting your data partition.


[edit] Background

The Official Software Image is split into four separate partitions: the u-boot partition, the kernel partition, a 256MB rootfs partition holding the main files and a 1.7GB partition for data.

The filesystem used is ubifs, a successor to jffs2 that was written for direct NAND access as used on the Ben.

This split between rootfs and data was introduced in order to save time when booting the NanoNote. Ubifs scans the partition on initial mount. For a single 2GB partition this takes around 8sec.

Right now the formatting of the data-partition does not happen automatically and therefore needs to be done manually.

[edit] Steps

On your Ben:

1. format the data partition:

ubiformat /dev/mtd3 -y

2. attach MTD device to UBI and create corresponding UBI device:

ubiattach /dev/ubi_ctrl -m 3

3. create UBI volume:

ubimkvol /dev/ubi1 -s 1730MiB -N data

we update the rootfs partition to 512MB after OpenWrt release: 2010-11-17, so aftaer 2010-11-17, it should be: (or you may want create more then 1 volume )
test in xiangfu's nanonote, MAX volume size is 1486MB, different nand may have different bad blocks. so using 1480MB.

ubimkvol /dev/ubi1 -s 1480MiB -N data

4. create mountpoint:

mkdir /data

5. mount UBI volume to mountpoint

mount -t ubifs ubi1:data /data/

[edit] Notes

You will need to remount the UBI volume after your next restart. To do so, log in via ssh again and repeat steps 2 and 5.

[edit] Ubifs Startup

If you want to make the new data be avaliable at start, create a script:

# cd /
# touch
# nano

And then paste this in:

ubiattach /dev/ubi_ctrl -m 3
mount -t ubifs ubi1:data /data/

Save using control + X, then yes

Now some links and permissions

# ln -s / /usr/bin/mount_data
# chmod +x  / /usr/bin/mount_data

Now add it to startup, is not the standard way but should work by editing:

# nano /etc/init.d/start

It should look like this:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006

boot() {
	source /etc/profile
#	/usr/bin/gmenu2x 

Now enable it at startup:

 #  /etc/init.d/start enable

[edit] More Info

See UBI User Land Tools

Personal tools