linux/Documentation/filesystems/ubifs.txt
<<
>>
Prefs
   1Introduction
   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.
  60It does not need stuff like fsck.ext2. UBIFS automatically replays its
  61journal 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
78tation/filesystems/ubifs.txt#L31" id="L31" class="line" name="L3entation/fina href="esysteclean reboots andfs.txt#L73" id="L7rbifs.line" name="L72">  72would scale us why UBIFS is 4ery different to4href="Documentat="Documentat="Docu) ==menfaultems/ubifs.txt#L63" id="L63" class="line" name="L81">  71<8a>The authors of UBIFS 8eliev8systems/ubifs.txt#L32" id="L32" class="line" name="L82">  72<8a>would scale logarithm8cally82atiblelk_on/fiiiiiiiiiiiiiiion/firisonref=ne gotion/l coadvcutag
  73<8a>but it would be binar8 inco8cks mayyyyyyyyyyyyyyyyyyyyyyyn/fileI2 wha hreftationsequ2" ithe ms/ubifs.txt#L32" id="L32" class="line" name="L84">  74<8a>changed to use UBI2
<8 href8"Docuno_lelk_on/ficu)        entationelk-on/fms/ubifs.txt#L32" id="L32" class="line" name="L85">  75<8a>
  76<8a>
  77<8a>Mount options
  71<9a>The authors of UBIFS 9eliev9systeDocum=n=ne yyyyyyyyyyyyyDideref=menfault"Documenton the se aitatiotem, wn=netem, wms/ubifs.txt#L63" id="L63" class="line" name="L92">  72<9a>would scale logarithm9cally92ysteDocum=lzoyyyyyyyyyyyyyyyDideref=menfault"Documenton the se aitatiotem, wlzotem, wms/ubifs.txt#L63" id="L63" class="line" name="L93">  73<9a>but it would be binar9 inco93ysteDocum=zlibyyyyyyyyyyyyyyDideref=menfault"Documenton the se aitatiotem, wzlibtem, wms/ubifs.txt#L63" id="L63" class="line" name="L94">  74<9a>changed to use UBI2
<9 href9systems/ubifs.txt#L35" id="L35" class="line" name="L95">  75<9a>
  76<9a>
  77<9a>Mount options
   8Ext2, XFS, JFS, etc. U9xt#L39systems/ubifs.txt#L59" id="L59" class="line" name="L9>   9>which work with MTD devline"99 that iton/filesysatio do nod pspecifitiousf="Dtem, wne"X_Ytem, w ntation/fne"X:NAMEtem, w sy" ixems/ubifs.txt#L73" id="L73" class="line" name="L100">  10file-system of this claumenlaunot bldevitem, wXtem, w isf="Document="Docum,item, wYtem, w isf="Doilesysa"Docum,ithe tem, wNAMEtem, w tems/ubifs.txt#L44" id="L44" class="line" name="L101">  11
  12To make it more clear,02menlasystems/ubifs.txt#L43" id="L43" class="line" name="L103">  13block devices.
  14
  151 MTD devices represen05menlasystems/ubifs.txt#L76" id="L76" class="line" name="L106">  16  rather large size, t06menla6ntation/fitem, wrootfstem, wiilesysation/filesyst=0atio/mntine" n (tem, wrootfstem, witheylesysms/ubifs.txt#L76" id="L76" class="line" name="L107">  17  small blocks, typica07menla7 id=, ty):ms/ubifs.txt#L43" id="L43" class="line" name="L108">  182 MTD devices support 08menla8yste$o do no-t ne" n ne"0:rootfso/mntine" nms/ubifs.txt#L43" id="L43" class="line" name="L109">  19  eraseblock, write to09menlaname="L72">  72would scale us why UBIFS is 4ery 110">  10file-system of this cllass 1s JFFSf="Documentatihilen exaonalwoulhref=attailestd0"L72">  72would scale us why UBIFS is 4ery 111">  11
  12To make it more clear,, her1 is a nagestd=0 root=ne"0:rootfsorootfsid="ane" nms/ubifs.txt#L43" id="L43" class="line" name="L113">  13block devices.
  14
  151 MTD devices represennt fl1sh dev1" class="line" name="L3entation/fina href="esysteclean r116">  16  rather large size, ttypic11systems/ubifs.txt#L77" id="L77" class="line" name="L117">  17  small blocks, typicaally 112 byttation/t#L77" id="LnearlFAQ/HOWTO umentat andweb site:ms/ubifs.txt#L43" id="L43" class="line" name="L118">  182 MTD devices support  3 ma1n opers/ubifs.thttp://www.ystem-std.infradead.org//t#ine" nahtml">http://www.ystem-std.infradead.org//t#ine" nahtmlystems/ubifs.txt#L77" id="L77" class="line" name="L119">  19  eraseblock, write too som1 offses/ubifs.thttp://www.ystem-std.infradead.org/faqine" nahtml">http://www.ystem-std.infradead.org/faqine" nahtmlystems/ubifs.txt#L12" id="L12" class="line" name="L120">  10  eraseblock. Block  1devic1s supp
ationrigisuriLXRref="Documbyentats/ubifs.thttp://sourcref=ge.net/umojects/lxr">LXRrDocmunitysupp,cumentexperi12" iley statiobyes/ubifs.tmailto:lxr@ystem.no">lxr@ystem.nosupp.
id="fil_cont erasebsubfooter">
lxr.ystem.no kindly hoss=dobyes/ubifs.thttp://www.redpill-ystumo.no">Redpillesysumo ASsupp,cich is mentasystend