MKFS.JFFS2(1)
π MKFS.JFFS2 π
okay so bestie, welcome to the mkfs.jffs2(1) page from the General Commands Manual β yes that's the manual name, it's in the title, we love her π
β¨ NAME β¨
mkfs.jffs2 β Create a JFFS2 file system image from directory
πΈ SYNOPSIS πΈ
mkfs.jffs2 [ -p,--pad[=SIZE] ] [ -r,-d,--root directory ] [
-s,--pagesize=SIZE ] [ -e,--eraseblock=SIZE ] [ -c,--cleanmarker=SIZE ]
[ -n,--no-cleanmarkers ] [ -o,--output image.jffs2 ] [ -l,--little-
endian ] [ -b,--big-endian ] [ -D,--devtable=FILE ] [ -f,--faketime ] [
-q,--squash ] [ -U,--squash-uids ] [ -P,--squash-perms ] [ --with-xattr
] [ --with-selinux ] [ --with-posix-acl ] [ -m,--compression-mode=MODE ]
[ -x,--disable-compressor=NAME ] [ -X,--enable-compressor=NAME ] [
-y,--compressor-priority=PRIORITY:NAME ] [ -L,--list-compressors ] [
-t,--test-compression ] [ -h,--help ] [ -v,--verbose ] [ -V,--version ]
[ -i,--incremental image.jffs2 ]
π¦ DESCRIPTION π¦
so mkfs.jffs2 makes a JFFS2 (Second Journalling Flash File System) file system image, and then writes that image out to the file you name with -o, or β if you didn't say anything β to standard output. but plot twist: if standard output happens to be a terminal device, mkfs.jffs2 will straight up abort. no image for you. π
the file system image gets built from all the files and directories hanging out inside the directory you point at with -r, or from the present directory if you never passed -r at all. keeping it local, love that. π«Ά
every single block of the files going into the image gets compressed using one of the available compressors, depending on whichever compression mode you picked. β¨
file systems are created with the same endianness as the host, unless you went and specified -b or -l. and like, history lesson: the JFFS2 driver in the 2.4 Linux kernel only supported images with the same endianness as the CPU. as of 2.5.48, the kernel can be changed with a #define to accept images of the non-native endianness. but full bi-endian support in the kernel is not planned. so. there's that. π
ngl it's unlikely that JFFS2 images are useful except alongside the MTD (Memory Technology Device) drivers in the Linux kernel, because the JFFS2 file system driver in the kernel needs MTD devices. it's giving very specific-use-case, and honestly? iconic for it. π
π OPTIONS π
okay so first, the little rule for all the options that take a SIZE argument: you can write that SIZE as decimal (like 65536), octal (like 0200000), or hexadecimal (like 0x1000). pick your fighter, bestie. π
-p,--pad[=SIZE]β pad the output out toSIZEbytes using0xFF. if you don't give aSIZEat all, the output gets padded to the end of the final erase block. cute little filler. πΈ-r,-d,--root=DIRβ build the file system from directoryDIR. the default is the current directory. yes, three ways to say the same thing, she contains multitudes. π-s,--pagesize=SIZEβ use page sizeSIZE. the default is4 KiB. this size is the maximum size of a data node. set it according to the target system's memory management page size. and fr fr: NOTE: this is NOT related to NAND page size. don't get it twisted. π«Ά-e,--eraseblock=SIZEβ use erase block sizeSIZE. the default is64 KiB. if you use an erase block size that's different from the erase block size of the target MTD device, JFFS2 may not perform optimally. π and if theSIZEyou specified is below4096, the units are assumed to beKiB.-c,--cleanmarker=SIZEβ writeCLEANMARKERnodes with the size specified. it is not normally appropriate to specify a size other than the default12bytes. so like, unless you know exactly why you're doing this, don't. π-n,--no-cleanmarkersβ do not writeCLEANMARKERnodes to the beginning of each erase block. this option can be useful for creating JFFS2 images for use on NAND flash, and for creating images which are to be used on a variety of hardware with differing eraseblock sizes. versatile queen. β¨-o,--output=FILEβ write the JFFS2 image to fileFILE. default is the standard output.-l,--little-endianβ create a little-endian JFFS2 image. default is to make an image with the same endianness as the host.-b,--big-endianβ create a big-endian JFFS2 image. default is to make an image with the same endianness as the host.-D,--devtable=FILEβ use the namedFILEas a device table file, for including devices and changing permissions in the created image when the user does not have appropriate permissions to create them on the file system used as source. permission-issue workaround, we stan a resourceful moment. π-f,--faketimeβ change all file timestamps to0for regression testing. time? never heard of her. β-q,--squashβ squash permissions and owners, making all files be owned by root and removing write permission forgroupandother. flatten it all out, bestie. π-U,--squash-uidsβ squash owners, making all files be owned by root.-P,--squash-permsβ squash permissions, removing write permission forgroupandother.--with-xattrβ enables xattr, stuffs all xattr entries into the jffs2 image file.--with-selinuxβ enables xattr, stuffs only SELinux Labels into the jffs2 image file.--with-posix-aclβ enable xattr, stuffs only POSIX ACL entries into the jffs2 image file.-m,--compression-mode=MODEβ set the default compression mode. the default mode ispriority, which tries the compressors in a predefined order and chooses the first successful one. the alternatives are:none(mkfs will not compress) andsize(mkfs will try all compressors and chooses the one which has the smallest result). picking the smallest result? that's the overachiever energy we love. π-x,--disable-compressor=NAMEβ disable a compressor. use-Lto see the list of the available compressors and their default states.-X,--enable-compressor=NAMEβ enable a compressor. use-Lto see the list of the available compressors and their default states.-y,--compressor-priority=PRIORITY:NAMEβ set the priority of a compressor. use-Lto see the list of the available compressors and their default priority. priorities are used by priority compression mode.-L,--list-compressorsβ show the list of the available compressors and their states.-t,--test-compressionβ call decompress after every compress β and compare the result with the original data β and some other check. double-checking your own work? self-aware icon behaviour. π₯-h,--helpβ display help text.-v,--verboseβ verbose operation.-V,--versionβ display version information.-i,--incremental=FILEβ generate an appendage image forFILE. ifFILEis written to flash and flash is appended with the output, then it seems as if it was one thing. sneaky seamless, iykyk. π¦
π LIMITATIONS π
the format and grammar of the device table file does not allow it to create symbolic links when the symbolic links are not already present in the root working directory. like, it simply cannot, bestie. no cap.
however β and this is the lil loophole β symbolic links may be specified in the device table file using the l type, for the purposes of setting their permissions and ownership. so it's not fully powerless. π
π BUGS π
JFFS2 limits device major and minor numbers to 8 bits each. some consider this a bug. (some do! and honestly, valid.) π
mkfs.jffs2 does not properly handle hard links in the input directory structure. currently, hard linked files will be expanded to multiple identical files in the output image. so your one file becomes many. it's giving clone army. not the slay we wanted. π
π AUTHORS π
- David Woodhouse
- Manual page written by David Schleef
<ds@schleef.org>
π SEE ALSO π
mkfs(8)mkfs.jffs(1)fakeroot(1)
and that's the whole page bestie, we ate, no crumbs left π β this was the mkfs.jffs2(1) page from the General Commands Manual, and the MKFS.JFFS2(1) footer tag at the very bottom is just her name signing off. mwah. πβ¨ππ¦
π¦ where this page comes from
- alpine 3.22: mtd-utils-doc 2.2.1-r0 Β· GPL-2.0-only
- alpine 3.23: mtd-utils-doc 2.2.1-r0 Β· GPL-2.0-only
- alpine 3.24: mtd-utils-doc 2.2.1-r0 Β· GPL-2.0-only
- arch rolling: mtd-utils 2.3.1-1 Β· GPL-2.0-only
- debian bookworm: mtd-utils 1:2.1.5-1 Β· GPL-2.0-or-later
- debian trixie: mtd-utils 1:2.3.0-1 Β· GPL-2.0-or-later
- fedora 43: mtd-utils 2.2.1-3.fc43 Β· GPL-2.0-or-later
- fedora 44: mtd-utils 2.2.1-4.fc44 Β· GPL-2.0-or-later
- nixos 26.05: mtd-utils 2.3.1
- nixpkgs unstable: mtd-utils 2.3.1
- opensuse-leap 16.0: mtd-utils 2.2.0-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mtd-utils 2.2.0-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mtd-utils 2.2.0-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mtd-utils 2.2.0-bp160.1.12 Β· GPL-2.0-or-later
- ubuntu jammy: mtd-utils 1:2.1.4-1 Β· GPL-2.0-or-later
- ubuntu noble: mtd-utils 1:2.2.0-1ubuntu2 Β· GPL-2.0-or-later
- ubuntu questing: mtd-utils 1:2.3.0-1ubuntu1
- ubuntu resolute: mtd-utils 1:2.3.0-1ubuntu2 Β· GPL-2.0-or-later
- ubuntu stonking: mtd-utils 1:2.3.1-3ubuntu3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms