# Understanding UBIFS flash overhead

Deepak Saxena dsaxena at plexity.net
Fri Oct 10 17:00:36 EDT 2008

```Artem,

I'm working on getting UBIFS going on the OLPC XO and am trying to
understand what I am seeing in regards to file system size.

I have partitioned the 1GiB mtd device into a 32MiB JFFS boot partition
for OFW, a 128KiB partition to hold the Redboot partition table,
and the remainder (991.625) for use by UBI.

The NAND device has 128KiB EBs with a 2KiB pages and we are running w/o
sub-page writes. Plugging this into the overhead calculation, we get:

SP	PEB Size		128KiB
SL	LEB Size		128KiB - 2 * 2KiB = 124 KiB
P	Total PEBs 		991.625MiB / 128KiB = 7933
B	Reserved PEBsg		79(1%)
O	Overhead= SP - SL	4KiB

UBI Overhead = (B + 4) * SP + O * (P - B - 4)
= (79 + 4) * 128Kib + 4 KiB * (7933 - 79 - 4)
= 42024 KiB
= 329.3125 PEBs (round to 329)

This leaves us with 7604 PEBs or 973312KiB available for user data.

At boot up, I see:

UBIFS: file system size: 995237888 bytes (971912 KiB, 949 MiB,
UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)

'df' returns:

Filesystem             Size   Used  Avail Use% Mounted on
mtd0                   822M   242M   581M  30% /

I expect some overhead, but I'm really wondering where over 100MiB of
space went!

This is 2.6.25 with UBI 2.6.25 tree merged in. Does that tree have
any bugfixes from 2.6.26+ backported?

~Deepak

--
_____   __o  Deepak Saxena - Living CarFree and CareFree          (o>
------    -\<,  "When I see an adult on a bicycle, I do not despair  //\
----- ( )/ ( )  for the future of the human race." -H.G Wells       V_/_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

```

More information about the linux-mtd mailing list