Skip to main content.
Navigation:
DENX
>
DULG
>
FlashFilesystemsJFFS2
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
DULG
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
DULG Home
BoardSelect
Manual
FAQ
Application Notes
Changes
Index
List of pages in DULG
Search
%SECTION0{name=FlashFilesystemsJffs2}% Second Version of JFFS Probably even more interesting for embedded systems is the second version of JFFS, *JFFS2*, since it not only fixes a few design issues with JFFS, but also adds transparent compression, so that you can save a lot of precious flash memory. The =mkfs.jffs2= tool is used to create a JFFS2 filesystem image; it populates the image with files from a given directory. For instance, to create a JFFS2 image for a flash partition of 3 MB total size and to populate it with the files from the _/tmp/flashtools_ directory you would use: <verbatim> # mkfs.jffs2 --pad=3145728 --eraseblock=262144 \ --root=/tmp/flashtools/ --output image.jffs2 # eraseall /dev/mtd4 Erased 3072 Kibyte @ 0 -- 100% complete. \# dd if=image.jffs2 of=/dev/mtd4 bs=256k 12+0 records in 12+0 records out # mount -t jffs2 /dev/mtdblock4 /mnt # df /mnt Filesystem 1k-blocks Used Available Use% Mounted on /dev/mtdblock4 3072 2488 584 81% /mnt </verbatim> %X% Note: Especially when you are running time-critical applications on your system you should carefully study if the behaviour of the flash filesystem might have any negative impact on your application. After all, a flash device is not a normal harddisk. This is especially important when your flash filesystem gets full; JFFS2 acts a bit weird then: * You will note that an increasing amount of CPU time is spent by the filesystem's garbage collection kernel thread. * Access times to the files on the flash filesystem may increase drastically. * Attempts to truncate a file (to free space) or to rename it may fail: <verbatim> ... # cp /bin/bash file cp: writing `file': No space left on device # >file bash: file: No space left on device # mv file foo mv: cannot create regular file `foo': No space left on device </verbatim> You will have to use <command>rm</command> to actually delete a file in this situation. This is especially critical when you are using the flash filesystem to store log files: when your application detects some abnormal condition and produces lots of log messages (which usually are especially important in this situation) the filesystem may fill up and cause _extreme_ long delays - if your system crashes, the most important messages may never be logged at all.
9.1.2. Journalling Flash File System
1. Abstract
9.1.4. Compressed ROM Filesystem
Prev
Home
Next