Journalling Flash File System

From DD-WRT Wiki

Revision as of 04:10, 26 July 2006 by AlReece45 (Talk | contribs)
Jump to: navigation, search



journaled flash file system (jffs) is used to store user programs and data into otherwise inaccessible flash memory. Inspite of general purpose read/write one must take care not to store frequently changed files on it as this can cause flash wear out. Journal file is used to minimize frequent overwrites.


To enable jffs (please read note about "flash wear out" above!) enter the following commands (when you're connected via ssh or telnet on a shell):

nvram set sys_enable_jffs2=1
nvram set sys_clean_jffs2=1
nvram set jffs_mounted=1
nvram commit

might reboot/hang after cleaning which might take long, so be patient

Maybe the options in the webinterface below work for you (they didn't for me):

JFFS2 enabled: X Enable Disable
Clean JFFS2: X Enable Disable


Log in and run:
ipkg update
ipkg list

Tested on pre5

jffs on WRT54G

Since the WRT54G contains too little memory, jffs will always report 'full'. If you dont need the extra stuff from 'normal you can reflash using the 'mini' distro and use jffs
However if you need 'normal' functionality but also want to use jffs (eg for ipkg) you can use samba to accomplish this.

1) disable jffs in the webgui if you had enabled it
2) create a network share on windows or linux (see also [Jffs_sharing_in_a_Linux_server])
3) create a script called "" on the share:


#smb settings: same as the settings in the webgui
# change these to mount a different share than the current at /jffs
SMBSHARE=`nvram get samba_share`
SMBUSER=`nvram get samba_user`
SMBPASS=`nvram get samba_password`

#script to start in /jffs once we're done mounting

#where to log what is happening
export SMBLOG=/tmp/smblog

####### ok, here we go... ;) #######
echo "" > $SMBLOG
cd /

#make sure jffs is unmounted. Its recommended to run without jffs enabled though.
echo "umounting /jffs if nescessary..." >> $SMBLOG
umount /jffs >> $SMBLOG 2>&1

#mount our smbshare at /jffs
echo "mounting $SMBSHARE at /jffs..." >> $SMBLOG
smbmount $SMBSHARE /jffs -o username=$SMBUSER,password=$SMBPASS >> $SMBLOG 2>&1

#hand over startup to the jffs part
/jffs/$JFFS_SCRIPT & >> $SMBLOG 2>&1

4) create a script called "" on the share:


#wait a sec, just to be sure the smb startup script has quit
sleep 1

#unmount the smbshare, its identical to /jffs now anyway :)
umount /tmp/smbshare

#to enable ipkg, we fake jffs enabled.
#since theres no commit, this wont actually enable jffs
nvram set sys_enable_jffs2=1

#ready to do specific stuff, like starting services
#or other commands from /jffs

5) in the webinterface, enable [Samba] with appropriate share/user/pass settings from step 2. Enter "" as the script
6) reboot

Now you should have the share configured in the webinterface mounted at /jffs and should also be able to run 'ipkg' !

If everything else fails

If you can't write to /jffs but need it for example for "ipkg" then you can umount it and then, if have a NAS or a share on a pc, mount a networkt share to /jffs.

I personally use a startup script to unmount/mount /jffs everytime the router starts up.. Works perfectly.

My boot script to mount the jffs partition is:

umount /jffs
smbmount //<server's IP>/jffs /jffs -o username=<your username, guest if hosted on windows>,password=<your password>

  • NOTE: Even though you are not using the jffs partition on the router, you must still have jffs enabled in order to use ipkg. Disabling jffs also disables ipkg!
  • OTHER NOTE: To save you the steep learning curve experienced by many users, if you're getting full errors and you're using a WRT54G, reflash with the mini distro. The normal version is too big!
  • EXTRA NOTE: If you are a Linux newbie, and you have problems with file permissions, look at this
  • BONUS NOTE OF HAPPINESS: You need to save the script files in UNIX format, not DOS. One text editor that can do this is UltraEdit. Or Crimson Editor, which is free :o)