JFFS2 File System Size Mismatches: Online Replication vs. Mkfs.jffs2

Grant Erickson gerickson at nuovations.com
Mon Sep 15 13:09:06 EDT 2008


I have an interesting JFFS2 anomaly with regards to file system sizes that I
am hoping someone on the list has some insight on. For my system, I produce
a root file system image using mkfs.jffs2 as follows:

    mkfs.jffs2 --big-endian --no-cleanmarkers --pad 512 --pagesize 512  \
    --eraseblock 16384                                                  \
    -d /tmp/tmp.AEvYZ20385 -D root.devtable -o root.jffs2

And I end up with an image that is 14.0 MiB in size. Compression is
effective in reducing the image size down from 20.0 MiB, the image size when
'-m none' is passed to mkfs.jffs2.

Installed on the target system, 'df -h' reports:

    Filesystem                Size      Used Available Use% Mounted on
    /dev/mtdblock11          20.0M     14.0M      6.0M  70% /

However, if I then replicate, using rsync, this file system onto an
identical, yet empty partition, I end up with a file system that 'df'
reports as substantially smaller despite the fact that the file system BOM
is identical, diff says everything is the same, and a random sampling of MD5
sums shows files to be identical:

    Filesystem                Size      Used Available Use% Mounted on
    /dev/mtdblock11          20.0M     14.0M      6.0M  70% /
    /dev/mtdblock9           20.0M      9.3M     10.7M  46% /mnt/root0

The kernel is configured as:

    CONFIG_JFFS2_FS=y
    CONFIG_JFFS2_FS_DEBUG=0
    CONFIG_JFFS2_FS_WRITEBUFFER=y
    # CONFIG_JFFS2_FS_WBUF_VERIFY is not set
    # CONFIG_JFFS2_SUMMARY is not set
    # CONFIG_JFFS2_FS_XATTR is not set
    # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
    CONFIG_JFFS2_ZLIB=y
    # CONFIG_JFFS2_LZO is not set
    CONFIG_JFFS2_RTIME=y
    # CONFIG_JFFS2_RUBIN is not set

My conclusion seems to be that mkfs.jffs2 and the kernel are compressing
things differently; however, 14.0 MiB seems to be the best I can coax out of
mkfs.jffs2 with any of LZO, ZLIB or RTIME.

Any insights or places to start digging? Have I discovered JFFS2 dark
matter? ;-)

Regards,

Grant





More information about the linux-mtd mailing list