Journalling Flash File System

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 04:11, 26 July 2006 (edit)
AlReece45 (Talk | contribs)
(Fixed last edit)
← Previous diff
Revision as of 06:31, 15 September 2006 (edit) (undo)
Lukrass (Talk | contribs)
(Instruction to unmount the jffs(in case it was too small :-))
Next diff →
Line 21: Line 21:
Clean JFFS2: X Enable Disable <br> Clean JFFS2: X Enable Disable <br>
 +To unmount the jffs(in case it was too small :-):
 +
 + nvram set sys_enable_jffs2=0
 + nvram set sys_clean_jffs2=0
 + nvram set jffs_mounted=0
 + nvram commit
 + reboot
 +
 +Afterwards you can nvram unset this variables.
==Testing== ==Testing==

Revision as of 06:31, 15 September 2006

Contents

Introduction

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.

Instructions

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
reboot

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):

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

To unmount the jffs(in case it was too small :-):

nvram set sys_enable_jffs2=0
nvram set sys_clean_jffs2=0
nvram set jffs_mounted=0
nvram commit
reboot

Afterwards you can nvram unset this variables.

Testing

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 "startup.smb.sh" on the share:

#!/bin/sh

#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
JFFS_SCRIPT=startup.jffs.sh

#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 "startup.jffs.sh" on the share:

#!/bin/sh

#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 "startup.smb.sh" 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)