UBI statement in kernel Doc

Source: Internet
Author: User

 

 

Introduction

==================

 

Ubifs file-system stands for ubi file system. ubi stands for "unsorted

Block images ". ubifs is a flash file system, which means it is designed

To work with Flash devices. It is important to understand, that ubifs

Is completely different to any traditional file-system in Linux, like

Ext2, XFS, JFS, etc. ubifs represents a separate class of file-Systems

Which work with MTD devices, not block devices. The other Linux

File-system of this class is jffs2.

 

To make it more clear, here is a small comparison of MTD devices and

Block devices.

 

1 MTD devices represent flash devices and they consist of eraseblocks

Rather large size, typically about 128kib. Block devices consist

Small blocks, typically 512 bytes.

2 MTD devices support 3 main operations-read from some offset within

Eraseblock, write to some offset within an eraseblock, and erase a whole

Eraseblock. Block devices support 2 main operations-read a whole

Block and write a whole block.

3 The whole eraseblock has to be erased before it becomes possible

Re-write its contents. blocks may be just re-written.

4 eraseblocks become worn out after some number of erase cycles-

Typically 100 k-1g for slc nand and nor flashes, and 1 K-10 K for MLC

Nand flashes. blocks do not have the wear-out property.

5 eraseblocks may become bad (only on NAND flashes) and software shocould

Deal with this. Blocks on hard drives typically do not become bad,

Because hardware has mechanisms to substitute Bad blocks, at least in

Modern LBA disks.

 

It shoshould be quite obvious why ubifs is very different to traditional

File-systems.

 

Ubifs works on top of ubi. ubi is a separate software layer which may be

Found in drivers/MTD/ubi. ubi is basically a volume Management and

Wear-leveling layer. It provides so called ubi volumes which is a higher

Level required action than a MTD device. The programming model of ubi Devices

Is very similar to MTD devices-they still consist of large eraseblocks,

They have read/write/erase operations, but ubi devices are using ID

Limitations like wear and Bad blocks (items 4 and 5 in the above list ).

 

In a sense, ubifs is a next generation of jffs2 file-system, but it is

Very different and incompatible to jffs2. The following are the main

Differences.

 

* Jffs2 works on top of MTD devices, ubifs depends on ubi and works on

Top of ubi volumes.

* Jffs2 does not have on-Media Index and has to build it while mounting,

Which requires full media scan. ubifs maintains the FS Indexing

Information on the Flash Media and does not require full media scan,

So it mounts faster times faster than jffs2.

* Jffs2 is a write-through file-system, while ubifs supports write-back,

Which makes ubifs much faster on writes.

 

Similarly to jffs2, ubifs supports on-the-flight compression which makes

It possible to fit quite a lot of data to the Flash.

 

Similarly to jffs2, ubifs is tolerant of unclean reboots and power-cuts.

It does not need stuff like fsck. ext2. ubifs automatically replays its

Journal and recovers from crashes, ensuring that the on-flash data

Structures are consistent.

 

Ubifs scales logarithmically (most of the data structures it uses are

Trees), so the Mount time and memory consumption do not linearly depend

On the flash size, like in case of jffs2. this is because ubifs

Maintains the FS index on the flash media. However, ubifs depends on

UBI, which scales linearly. So overall ubi/ubifs stack scales linearly.

Nevertheless, ubi/ubifs scales considerably better than jffs2.

 

The authors of ubifs believe, that it is possible to develop ubi2 which

Wocould scale logarithmically as well. ubi2 wocould support the same API as Ubi,

But it wowould be binary incompatible to ubi. So ubifs wowould not need to be

Changed to use ubi2

 

 

Mount options

==================

 

(*) = Default.

 

Bulk_readread more in one go to take advantage of Flash

Media that read faster sequentially

No_bulk_read (*) do not bulk-read

No_chk_data_crcskip checking of CRCs on data nodes in order

Improve read performance. Use this option only

If the Flash Media is highly reliable. The effect

Of this option is that upload uption OF THE CONTENTS

Of a file can go unnoticed.

Chk_data_crc (*) do not skip checking CRCs on data nodes

Compr = none override default compressor and set it to "NONE"

Compr = lzo override default compressor and set it to "lzo"

Compr = zlib override default compressor and set it to "zlib"

 

 

Quick usage instructions

======================================

 

The ubi volume to mount is specified using "ubix_y" or "ubix: Name" syntax,

Where "X" is ubi device number, "Y" is ubi volume number, and "name" is

UBI volume name.

 

Mount volume 0 on ubi device 0 to/mnt/ubifs:

$ Mount-T ubifs ubi0_0/mnt/ubifs

 

Mount "rootfs" volume of ubi device 0 to/mnt/ubifs ("rootfs" is volume

Name ):

$ Mount-T ubifs ubi0: rootfs/mnt/ubifs

 

The following is an example of the kernel boot arguments to attach mtd0

To ubi and mount volume "rootfs ":

UBI. MTD = 0 root = ubi0: rootfs rootfstype = ubifs

 

 

Module parameters for debugging

====================================

 

When ubifs has been compiled with debugging enabled, there are 3 Module

Parameters that are available to control aspects of testing and debugging.

The parameters are unsigned integers where each bit controls an option.

The parameters are:

 

Debug_msgsselects which debug messages to display, as follows:

 

Message typeflag Value

 

General messages1

Journal messages2

Mount messages4

Commit messages8

LEB search messages16

Budgeting messages32

Garbage collection messages64

Tree node cache (TNC) messages128

LEB properties (lprops) messages256

Input/Output messages512

Log messages1024

Scan messages2048

Recovery messages4096

 

Debug_chksselects extra checks that ubifs can do while running:

 

Checkflag Value

 

General checks1

Check Tree node cache (TNC) 2

Check indexing tree size4

Check orphan area8

Check old indexing tree16

Check LEB properties (lprops) 32

Check leaf nodes and inodes64

 

Debug_tstsselects a mode of testing, as follows:

 

Test modeflag Value

 

Force in-the-gaps method2

Failure Mode for recovery testing4

 

For example, set debug_msgs to 5 to display general messages and Mount

Messages.

 

 

References

============

 

Ubifs documentation and FAQ/howto at the MTD web site:

Http://www.linux-mtd.infradead.org/doc/ubifs.html

Http://www.linux-mtd.infradead.org/faq/ubifs.html

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.