JFFS2 file sizes

Ian Bicking ianb at colorstudy.com
Wed Jul 25 16:37:42 EDT 2007


Ian Bicking wrote:
> When considering what content can be shipped or stored on the laptop, 
> we're wondering what the real disk(/flash) usage is for files.  Since 
> JFFS2 is doing compression behind the scenes, it's not completely clear. 
>   Also, it would be nice if we could estimate how much disk something 
> will use without actually having to put the content on a laptop.

 From Chris Ball and David Woodhouse on IRC I understand that:

JFFS2 compresses 4K chunks using zlib.  So it's not just per-file 
compression, it's compressing bits of a file.  It doesn't compress files 
where compression doesn't help.  And there's a 68 byte overhead per 
compressed chunk.  Plus probably some fixed overhead per file.

Running "mkfs.jffs2 --root DIR | wc" gives a more accurate picture of 
the size of a directory.  Things might change as the compression 
parameters of JFFS2 are changed; specifically LZO compression is better 
than zlib, and there might be an attribute to disable compression on a 
particular file.

I wrote a little Python script to estimate the size and compare it to 
the actual size from mkfs.jffs2 (if you have that available on your 
system), and to the original size.  For small files (500 bytes - 1.5K) 
it's compressed to 50% of the size, for Python source code 40% of the 
size (with .pyc files), the Gnome 2 User Guide (with lots of images) 
gets to about 65% (35% reduction).

Script at: http://svn.colorstudy.com/home/ianb/olpc/jffs2size.py

-- 
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org
             : Write code, do good : http://topp.openplans.org/careers


More information about the Library mailing list