blob: a0a61d2f389f409602d2ac266e7e803c22f74406 [file] [log] [blame]
Artem Bityutskiye56a99d2008-07-14 19:08:34 +03001Introduction
2=============
3
4UBIFS file-system stands for UBI File System. UBI stands for "Unsorted
5Block Images". UBIFS is a flash file system, which means it is designed
6to work with flash devices. It is important to understand, that UBIFS
7is completely different to any traditional file-system in Linux, like
8Ext2, XFS, JFS, etc. UBIFS represents a separate class of file-systems
9which work with MTD devices, not block devices. The other Linux
10file-system of this class is JFFS2.
11
12To make it more clear, here is a small comparison of MTD devices and
13block devices.
14
151 MTD devices represent flash devices and they consist of eraseblocks of
16 rather large size, typically about 128KiB. Block devices consist of
17 small blocks, typically 512 bytes.
182 MTD devices support 3 main operations - read from some offset within an
19 eraseblock, write to some offset within an eraseblock, and erase a whole
20 eraseblock. Block devices support 2 main operations - read a whole
21 block and write a whole block.
223 The whole eraseblock has to be erased before it becomes possible to
23 re-write its contents. Blocks may be just re-written.
244 Eraseblocks become worn out after some number of erase cycles -
25 typically 100K-1G for SLC NAND and NOR flashes, and 1K-10K for MLC
26 NAND flashes. Blocks do not have the wear-out property.
275 Eraseblocks may become bad (only on NAND flashes) and software should
28 deal with this. Blocks on hard drives typically do not become bad,
29 because hardware has mechanisms to substitute bad blocks, at least in
30 modern LBA disks.
31
32It should be quite obvious why UBIFS is very different to traditional
33file-systems.
34
35UBIFS works on top of UBI. UBI is a separate software layer which may be
36found in drivers/mtd/ubi. UBI is basically a volume management and
37wear-leveling layer. It provides so called UBI volumes which is a higher
38level abstraction than a MTD device. The programming model of UBI devices
39is very similar to MTD devices - they still consist of large eraseblocks,
40they have read/write/erase operations, but UBI devices are devoid of
41limitations like wear and bad blocks (items 4 and 5 in the above list).
42
43In a sense, UBIFS is a next generation of JFFS2 file-system, but it is
44very different and incompatible to JFFS2. The following are the main
45differences.
46
47* JFFS2 works on top of MTD devices, UBIFS depends on UBI and works on
48 top of UBI volumes.
49* JFFS2 does not have on-media index and has to build it while mounting,
50 which requires full media scan. UBIFS maintains the FS indexing
51 information on the flash media and does not require full media scan,
52 so it mounts many times faster than JFFS2.
53* JFFS2 is a write-through file-system, while UBIFS supports write-back,
54 which makes UBIFS much faster on writes.
55
56Similarly to JFFS2, UBIFS supports on-the-flight compression which makes
57it possible to fit quite a lot of data to the flash.
58
59Similarly to JFFS2, UBIFS is tolerant of unclean reboots and power-cuts.
Sebastian Siewior2e244d02008-07-17 14:16:09 +020060It does not need stuff like fsck.ext2. UBIFS automatically replays its
Artem Bityutskiye56a99d2008-07-14 19:08:34 +030061journal and recovers from crashes, ensuring that the on-flash data
62structures are consistent.
63
64UBIFS scales logarithmically (most of the data structures it uses are
65trees), so the mount time and memory consumption do not linearly depend
66on the flash size, like in case of JFFS2. This is because UBIFS
67maintains the FS index on the flash media. However, UBIFS depends on
68UBI, which scales linearly. So overall UBI/UBIFS stack scales linearly.
69Nevertheless, UBI/UBIFS scales considerably better than JFFS2.
70
71The authors of UBIFS believe, that it is possible to develop UBI2 which
72would scale logarithmically as well. UBI2 would support the same API as UBI,
73but it would be binary incompatible to UBI. So UBIFS would not need to be
74changed to use UBI2
75
76
77Mount options
78=============
79
80(*) == default.
81
Adrian Hunter4793e7c2008-09-02 16:29:46 +030082bulk_read read more in one go to take advantage of flash
83 media that read faster sequentially
84no_bulk_read (*) do not bulk-read
Artem Bityutskiy2bcf0022011-03-10 16:26:32 +020085no_chk_data_crc (*) skip checking of CRCs on data nodes in order to
Adrian Hunter2953e732008-09-04 16:26:00 +030086 improve read performance. Use this option only
87 if the flash media is highly reliable. The effect
88 of this option is that corruption of the contents
89 of a file can go unnoticed.
Artem Bityutskiy2bcf0022011-03-10 16:26:32 +020090chk_data_crc do not skip checking CRCs on data nodes
Artem Bityutskiy80736d42008-12-30 17:44:02 +020091compr=none override default compressor and set it to "none"
92compr=lzo override default compressor and set it to "lzo"
93compr=zlib override default compressor and set it to "zlib"
Artem Bityutskiye56a99d2008-07-14 19:08:34 +030094
95
96Quick usage instructions
97========================
98
99The UBI volume to mount is specified using "ubiX_Y" or "ubiX:NAME" syntax,
100where "X" is UBI device number, "Y" is UBI volume number, and "NAME" is
101UBI volume name.
102
103Mount volume 0 on UBI device 0 to /mnt/ubifs:
104$ mount -t ubifs ubi0_0 /mnt/ubifs
105
106Mount "rootfs" volume of UBI device 0 to /mnt/ubifs ("rootfs" is volume
107name):
108$ mount -t ubifs ubi0:rootfs /mnt/ubifs
109
110The following is an example of the kernel boot arguments to attach mtd0
111to UBI and mount volume "rootfs":
112ubi.mtd=0 root=ubi0:rootfs rootfstype=ubifs
113
Artem Bityutskiye56a99d2008-07-14 19:08:34 +0300114References
115==========
116
117UBIFS documentation and FAQ/HOWTO at the MTD web site:
118http://www.linux-mtd.infradead.org/doc/ubifs.html
119http://www.linux-mtd.infradead.org/faq/ubifs.html