balena-os / balena-chip

Balena support for C.H.I.P. boards
Apache License 2.0
3 stars 0 forks source link

Big overhead with small UBIFS volumes #26

Open michal-mazurek opened 7 years ago

michal-mazurek commented 7 years ago

It seems that ubifs consumes around 30MB of each partition for internal use. I've found other people having a similar situation (links below), with no explanation available. https://unix.stackexchange.com/questions/294656/surprisingly-big-overhead-when-creating-small-ubifs-volume https://e2e.ti.com/support/arm/sitara_arm/f/791/t/409157 http://wiki.laptop.org/go/UBIFS_initial_experiments#Initial_Findings.2C_Oddities.2C_and_Thoughts The documentation explains that some space will be reserved here: http://www.linux-mtd.infradead.org/doc/ubi.html#L_overhead -- but not as much as we're seeing.

michal-mazurek commented 7 years ago

Perhaps this is caused by the LEB size being half of the PEB size:

=> ubi info
UBI: MTD device name:            "mtd=4"
UBI: MTD device size:            8176 MiB
UBI: physical eraseblock size:   4194304 bytes (4096 KiB)
UBI: logical eraseblock size:    2064384 bytes
=> ubi info l
Volume information dump:
        vol_id          0
        reserved_pebs   36
        alignment       1
        data_pad        0
        vol_type        3
        name_len        10
        usable_leb_size 2064384
        used_ebs        36
        used_bytes      74317824
        last_eb_bytes   2064384
        corrupted       0
        upd_marker      0
        name            resin-boot

When trying to create a fs with bigger LEBs:

| Error: too large LEB size 4161536, maximum is 2097152
michal-mazurek commented 7 years ago

Excerpt from the docs: UBI reserves a physical eraseblock for each logical eraseblock. http://www.linux-mtd.infradead.org/faq/ubi.html