File-compression on ubifs

Richard Weinberger richard.weinberger at
Tue Jun 4 14:04:29 PDT 2019

On Fri, May 17, 2019 at 1:37 PM Shibin George
<george.shibin1993 at> wrote:
> Hi everyone,
> Had a query regarding mkfs.ubifs tool. I created an empty ubifs
> filesystem using:
> mkfs.ubifs -y /dev/ubiX_Y

No need to run mkfs.ubifs, just mount an empty ubi volume as ubifs, it
will auto create
a filesystem for you.

> I was wondering that if I now create a new file on this filesystem
> (after mount()), would compression be enabled or disabled for that
> file by-default? I am sorry but I could quite grasp this from the
> mkfs.ubifs code.

Compression is enabled by default, unless the filesystem is encrypted.
You can also override the default compressor using the compr= mount-option.

> Another query that I have is this:
> Would ubifs do a better job at compression if it knows the root-dir
> contents ahead of time? In other words, is on-the-fly compression of a
> file (i.e. compression at the time of creating/writing to a file)
> generally worse than when the same file is known to ubifs at the time
> of image creation?

UBIFS compression works on 4k chunks, it should not matter whether you compress
at runtime or at mkfs.ubifs time.

If you're looking for better compression rates, give our zstd patches a try.
You can find them on the mailinglist.


More information about the linux-mtd mailing list