Difference between revisions of "UBIFS"
(Created page with "== Introduction == [http://www.linux-mtd.infradead.org/doc/ubifs.html UBIFS] is a filesystem that works on top of [http://elinux.org/File_Systems#UBI UBI] volumes * UBIFS pres...") |
(No difference)
|
Revision as of 09:04, 12 October 2012
Introduction
UBIFS is a filesystem that works on top of UBI volumes
- UBIFS presentation slides: ubifs.odp
UBIFS vs. YAFFS2 comparisons for 2.6.31.1
First, see our Flash_Filesystem_Benchmarks for more recent benchmarks.
Hardware: MIPS, 403MHz CPU, 1GB Nand Flash
IOZone results: 4M, 8M & 16M file sizes in 980MB partition.
- mount time
- "1st mount" : time for mounting just after "flash_eraseall".
- "Empty" : time for mounting after "1st mount".(there's no files in partition)
- "Full" : time for mounting after creating files util the partition is full.(file size is random.)
- "Ubiattach" time for attaching 980MB partition into the ubi layer using ubiattach util.
Ubiattach | Ubifs | Yaffs2 | |
---|---|---|---|
1st mount | 2.59 sec | 0.17 sec | 2.25 sec |
Empty | 2.57 sec | 0.11 sec | 0.03 sec |
Full | 2.63 sec | 0.16 sec | 0.80 sec |
- IOZone results
4M | write | rewrite | read | reread | r.read | r.write | b.read | r.rewrite | s.read | fwrite | frewrite | fread | freread |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yaffs2 | 1538 | 1527 | 296962 | 297696 | 297825 | 1521 | 296876 | 1526 | 295164 | 1536 | 1524 | 297436 | 299021 |
ubifs | 19913 | 20989 | 298346 | 297631 | 299809 | 20968 | 298368 | 20181 | 299458 | 20471 | 20962 | 297371 | 297760 |
ubifs/yaffs2 | 12.95 | 13.75 | 1.00 | 1.00 | 1.01 | 13.79 | 1.01 | 13.22 | 1.01 | 13.33 | 13.75 | 1.00 | 1.00 |
16M | write | rewrite | read | reread | r.read | r.write | b.read | r.rewrite | s.read | fwrite | frewrite | fread | freread |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yaffs2 | 1538 | 1523 | 297199 | 298525 | 298896 | 1528 | 298433 | 1525 | 298847 | 1538 | 1525 | 299661 | 300656 |
ubifs | 20501 | 20656 | 298272 | 299109 | 299032 | 20521 | 298417 | 20710 | 298923 | 20448 | 20521 | 298259 | 299267 |
ubifs/yaffs2 | 13.33 | 13.56 | 1.00 | 1.00 | 1.00 | 13.43 | 1.00 | 13.58 | 1.00 | 13.30 | 13.46 | 1.00 | 1.00 |
32M | write | rewrite | read | reread | r.read | r.write | b.read | r.rewrite | s.read | fwrite | frewrite | fread | freread |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yaffs2 | 1539 | 1525 | 296537 | 297204 | 297253 | 1527 | 297177 | 1527 | 296583 | 1531 | 1523 | 296537 | 297463 |
ubifs | 20474 | 20611 | 296765 | 297490 | 297334 | 20659 | 296972 | 38416 | 297371 | 19068 | 20059 | 296618 | 296658 |
ubifs/yaffs2 | 13.30 | 13.52 | 1.00 | 1.00 | 1.00 | 13.53 | 1.00 | 25.16 | 1.00 | 12.45 | 13.17 | 1.00 | 1.00 |
Creating UBI Image
This is easiest to do, if you have access to the device and can run ubinfo and dmesg, otherwise you'll need to determine the volume size, Logical Erase Block size, etc by other means. UBI has some block overhead, which I found documentation inconsistent with my particular application, so your results may very. If your device is one UBI image for the entire NAND, this should be easier, and could probably be determined by just mounting a copy of the UBI image from the device if available.
To create the image from a rootfs you've built first you need to create the ubi.ini file, that describes your ubi image. Create a regular text file, ubi.ini, example contents, for more info run ubinize -h:
[ubi_rfs] mode=ubi image=ubifs.img vol_id=0 vol_size=87349248 vol_type=dynamic vol_name=ubi_rfs vol_alignment=1 vol_flags=autoresize
Next you'll run the commands that actually build it. Here ubi.ini is the file you just created, ubifs.img is a temp file you can delete once you are done, and your_erootfs.ubi is the name of the rootfs image that will be created.
sudo /usr/sbin/mkfs.ubifs -m 2048 -e 129024 -c 677 -r /path/to/rootfs ubifs.img sudo /usr/sbin/ubinize -o your_erootfs.ubi -p 131072 -m 2048 -s 512 -O 512 ubi.ini
To determine these and the ubi.ini file settings, use ubinfo -a and dmesg on the device if possible, which both give plenty of information about the values needed. The size and vol_name are listed under "Present volumes" when you run ubinfo -a on the device. The second half of that particular ubi device's description. While the NAND description's PEB, LEB etc are in dmesg.
mkfs.ubifs
- -m - Minimum I/O unit size.
- -e - Logical Erase Block (LEB) size.
- -c - Max LEB count. (vol_size/LEB)
- -r - Path to root filesystem.
- ubifs.img - Temporary image file.
ubinize
- -o - Output file.
- -p - Physical Erase Block (PEB) size.
- -m - Minimum I/O unit size.
- -s - Minimum I/O size for UBI headers, eg. sub-page size.
- -O - VID header offset from start of PEB.
- ubi.ini - UBI image configuration file.