Journalling Flash File System

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 23:04, 12 December 2005 (edit)
212.62.19.185 (Talk)

← Previous diff
Current revision (16:32, 14 February 2024) (edit) (undo)
Kernel-panic69 (Talk | contribs)
((add note to use USB storage))
 
(111 intermediate revisions not shown.)
Line 1: Line 1:
-=Introduction=+{{languages|Journalling_Flash_File_System}}
-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=+'''NOTE: Use USB storage if your router has USB port. Read [https://forum.dd-wrt.com/phpBB2/download.php?id=54383 USB Storage guide by egc].
 +'''
-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):+__TOC__
- nvram set sys_enable_jffs2=1<br>+= Introduction =
- nvram commit<br>+'''[[Glossary#Journalling Flash File System (JFFS)|Journalling Flash File System]]''' (JFFS/JFFS2) is a re-writable area within a DD-WRT-enabled device.
- reboot<br>+
-Maybe the options in the webinterface below work for you (they didn't for me):+* Located in ''/jffs''.
- Administration:<br>+Contents stored:
- JFFS2 enabled: X Enable Disable <br>+* On DD-WRT Device main flash directly on the device (''/jffs''), or
- Clean JFFS2: X Enable Disable <br>+* ''mount --bind /storagelocation /jffs''.<br>Where ''storagelocation'' is
 +** Off-board supplemental flash, see [[SD/MMC_mod]], (''/mmc/jffs'').
 +** Network Area Storage [NAS], or Server. (''//servername/sharename'')
 +** JFFS reports as it's own free space, the free space on Share or SD Card, in the Web Interface
 +'''Examples of the kind of programs and data are''':
 +* Custom configuration files
 +* NoCat splash pages and configuration
 +* [[Ipkg|ipkg]] (Requires JFFS. See ipkg.)
 +* Web-site hosting
 +* Many other things.
 +* JFFS must be Enabled for certain /jffs-dependent applications.
-==Testing== 
-Log in and run:<br> 
-ipkg update<br> 
-ipkg list<br> 
-Tested on pre5<br><br>+= Enable JFFS: Create ''/jffs'' =
-==If everything else fails==+==Prerequisites==
-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.+To enable JFFS you will need a router with at least 4MB flash, a build that supports JFFS such as the Mini build which is the smallest build to support JFFS thus leaving the most space for the JFFS partition, and your build must leave at least 324KB of flash free for the JFFS file system structure which will not be usable space. v24 pre-SP2 Standard builds no longer leave enough space for JFFS on 4MB devices so use the Mini build or one of Eko's specialty builds.
-<div id="kbektt12025" style="overflow:auto;height:1px;">+''Very old versions of some Linksys routers (no longer manufactured for many years) contained 8MB of Flash and 32MB of RAM, many DD-WRT-capable devices today contain 4MB of Flash memory; a few models from certain manufacturers contain more flash (La Fonera, [[ASUS WL-500g Premium|ASUS WL-500GP]]), some contain less (2MB). See [[Supported_Devices|Supported Devices]].<br>
-[http://health.20mbweb.com/buy-adipex/ buy adipex]+ 
-[http://health.20mbweb.com/buy-ambien/ buy ambien]+Note that '''DD-WRT v24sp1 VPN builds have the JFFS feature removed''', presumably due to conflicts that Brainslayer found between JFFS and bandwidth monitoring. See [http://www.dd-wrt.com/phpBB2/viewtopic.php?t=31932&postdays=0&postorder=asc&highlight=jffs+menu&start=0 this thread] for more information. Users interested in v24sp2 can opt:
-[http://health.20mbweb.com/buy-cialis/ buy cialis]+ 
-[http://health.20mbweb.com/buy-fioricet/ buy fioricet]+# Use a build other than VPN, both MINI and MEGA still have JFFS
-[http://health.20mbweb.com/buy-phentermine/ buy phentermine]+# Use an older build of DD-WRT
-[http://health.20mbweb.com/buy-soma/ buy soma]+# Use a custom build, either homemade or [http://www.dd-wrt.com/dd-wrtv2/downloads/others/eko/V24_TNG/svn10086/dd-wrt.v24-10086_NEWD_openvpn_jffs_small.bin dd-wrt.v24-10086_NEWD_openvpn_jffs_small.bin], which is described [http://www.dd-wrt.com/phpBB2/viewtopic.php?t=36037&p=200431#200431 here] as missing "snmp, all languages, some GUI styles and more.".
-[http://health.20mbweb.com/buy-tramadol/ buy tramadol]+ 
-[http://health.20mbweb.com/buy-valium/ buy valium]+====NOTE FOR ASUS WL500W====
-[http://health.20mbweb.com/buy-viagra/ buy viagra]+ 
-[http://health.20mbweb.com/buy-xanax/ buy xanax]+As of October 7th, 2009, consider the following or you may BRICK your WL500W router:
-[http://health.20mbweb.com/buy-tamiflu/ buy tamiflu]+ 
-[http://tw886.to/viagra/ buy viagra]+* Brainslayers mega flash size - 7.33MB
-[http://tw886.to/phentermine1/ buy phentermine]+* Eko's Big Flash size - 5.9MB
-[http://tw886.to/ambien/ buy ambien]+ 
-[http://tw886.to/soma/ buy soma]+Now, the error only occurs when JFFS2 is enabled and the router reboots, so you are safe if you DONT enable JFFS2.
-[http://tw886.to/carisoprodol/ buy carisoprodol]+ 
-[http://tw886.to/ringtones/ free ringtones]+Total available JFFS2 size for BS's build is 640KB which overwhelms the kernel and causes a panic. Even using a storage device with the command mount -o bind /mnt/jffs /jffs will still cause a kernel panic.
-[http://tw886.to/hydrocodone/ buy hydrocodone]+ 
-[http://tw886.to/adipex/ buy adipex]+Eko's JFFS2 partition size is 1640KB+, allowing much more room.
-[http://tw886.to/xenical/ buy xenical]+ 
-[http://tw886.to/cialis/ buy cialis]+I tested this on BS's 12996,12874 and 12533 builds and partially bricked my router several times. (A simple power disconnect for 30 secs will allow it to recover)
-[http://tw886.to/ultram/ buy ultram]+ 
-[http://tw886.to/fioricet/ buy fioricet]+Eko's build however works flawlessly AND provides the SAME features (except for connection warning) as BS's.
-[http://tw886.to/valium/ buy valium]+ 
-[http://tw886.to/vicodin/ buy vicodin]+One thing I am still unsure of is why this particular model Asus router is subject to this bug, but in the mean time, I suggest using Eko's Big build until the dev's can work it out..
-[http://lucky7.to/viagra/ buy viagra]+ 
-[http://lucky7.to/phentermine1/ buy phentermine]+== Flash Wear: A Warning ==
-[http://lucky7.to/tramadol/ buy tramadol]+Take care not to store frequently changing files (i.e. often-changing log files) on Flash as this can cause flash wear-out over time.
-[http://lucky7.to/ambien/ ambien]+* A journalling flash file system is specifically designed to minimize frequent overwrites.
-[http://lucky7.to/adipex1/ buy adipex]+* Files which are read many times but written infrequently work well on main flash.
-[http://lucky7.to/cialis/ buy cialis]+* Using the space provided by [[SD/MMC_mod]] places wear on replaceable secondary flash storage.
-[http://lucky7.to/hydrocodone/ buy hydrocodone]+ 
-[http://viagra.fb.bz/ buy viagra]+ 
-[http://buy-ambien.fb.bz/ buy ambien]+== Directions for (normal) users: using Web-GUI Interface==
-[http://buy-adipex.fb.bz/ buy adipex]+''The steps to enable JFFS through the router web page are very specific. To avoid having to reset and reprogram your router, it's smart to make a backup here of your settings. If you follow these steps exactly, it should not lock up.''
-[http://buy-tramadol.fb.bz/ buy tramadol]+# On the router web page click on ''Administration''.
-[http://buy-hydrocodone.fb.bz/ buy hydrocodone]+# Scroll down until you see ''JFFS2 Support'' section.
-[http://buy-xanax.fb.bz/ buy xanax]+# Click ''Enable JFFS''.
-[http://buy-xenical.fb.bz/ buy xenical]+# Click ''Save''.
-[http://buy-soma.fb.bz/ buy soma]+# Wait couple seconds, then click ''Apply''.
-[http://buy-carisoprodol.fb.bz/ buy carisoprodol]+# Wait again. Go back to the ''Enable JFFS'' section, and enable ''Clean JFFS''.
-[http://buy-ultram.fb.bz/ buy ultram]+# '''Do not click "Save".''' Click '''Apply''' instead.<br><br>The router formats the available space.<br><br>
-[http://buy-valium.fb.bz/ buy valium]+# Wait till you get the web-GUI back, then disable "Clean JFFS" again.
-[http://buy-vicodin.fb.bz/ buy vicodin]+# Click "Save".
-[http://buy-phentermine.fb.bz/ buy phentermine]+# It may be wise to Reboot the router, just to make sure
-[http://buy-fioricet.fb.bz/ buy fioricet]+ 
-[http://buy-viagra.fb.bz/ buy viagra]+If you don't see the Enable JFFS option on your Administration page, it is likely because your router has insufficient flash memory to hold both DD-WRT and a JFFS partition. If you have a 4MB router, you may be able to work around this by using the [[What is DD-WRT?#Broadcom Based Devices|mini]] version of DD-WRT
-[http://buy-cialis.fb.bz/ buy cialis]+ 
-[http://lucky7.to/valium/ buy valium]+==Directions for (freaky) Linux Gurus: CLI==
-[http://lucky7.to/ultram/ buy ultram]+'''WARNING'''
-[http://lucky7.to/carisoprodol/ buy carisoprodol]+ 
-[http://lucky7.to/fioricet/ buy fioricet]+A user comments: I tried the following commands under La Fonera firmware v24 RC4 and corrupted all my settings. I had to recover my unit with the procedures on La Fonera flashing page. I am not sure if this is a bug or these commands are not suited for La Fonera. Please try to use the web interface above. It works for me.
-[http://lucky7.to/vicodin/ buy vicodin]+ 
-[http://lucky7.to/soma/ buy soma]+Enter the following commands from the CLI:
-[http://lucky7.to/xanax/ buy xanax]+
-[http://lucky7.to/xenical/ buy xenical]+ nvram set jffs_mounted=1
-[http://lucky7.to/meridia/ buy meridia]+ nvram set enable_jffs2=1
-[http://lucky7.to/alprazolam/ buy alprazolam]+ nvram set sys_enable_jffs2=1
-[http://buy-ambien.qdo.org/ buy ambien]+ nvram set clean_jffs2=1
-[http://buy-viagra-online.qdo.org/ buy viagra]+ nvram set sys_clean_jffs2=1
-[http://buy-phentermine.qdo.org/ buy phentermine]+ nvram commit
-[http://buy-adipex.qdo.org/ buy adipex]+ reboot
-[http://buy-tramadol.qdo.org/ buy tramadol]+ 
-[http://buy-xanax.qdo.org/ buy xanax]+ 
-[http://buy-xenical.qdo.org/ buy xenical]+ 
-[http://buy-valium.qdo.org/ buy valium]+Note: Device might reboot/hang after cleaning which might take long; be patient.
-[http://buy-hydrocodone.qdo.org/ buy hydrocodone]+ 
-[http://cheap-phentermine.fb.bz/ cheap phentermine]+To unmount the JFFS:
-[http://cheap-viagra.fb.bz/ cheap viagra]+ 
-[http://ultram.fb.bz/ ultram]+ nvram set sys_enable_jffs2=0
-[http://meridia.fb.bz/ meridia]+ nvram set sys_clean_jffs2=0
-[http://alprazolam.fb.bz/ alprazolam]+ nvram set jffs_mounted=0
-[http://carisoprodol.fb.bz/ carisoprodol]+ nvram commit
-[http://xanax.fb.bz/ xanax]+ reboot
-[http://ambien.fb.bz/ ambien]+ 
-[http://xenical.fb.bz/ xenical]+Afterwards you can delete these variables with "nvram unset <variable>".
-[http://fioricet.fb.bz/ fioricet]+ 
-[http://soma.fb.bz/ soma]+=Options for Increasing JFFS Space=
-[http://buy-viagra.24us.info/ buy viagra]+ 
-[http://buy-phentermine.24us.info/ buy phentermine]+== Add a 1GB flash memory card ==
-[http://buy-ambien.24us.info/ buy ambien]+* Add the [[SD/MMC mod]]
-[http://buy-adipex.24us.info/ buy adipex]+** up to (at least) 1GB storage using common swappable SD memory cards (built-in support with DD-WRT v2.4 and later).
-[http://buy-tramadol.24us.info/ buy tramadol]+** create the folder /mmc/jffs
-[http://buy-hydrocodone.24us.info/ buy hydrocodone]+::: ''mkdir /mmc/jffs''
-[http://buy-xanax.24us.info/ buy xanax]+:* Use the Mount Bind command to point /jffs to the storage card:
-[http://buy-xenical.24us.info/ buy xenical]+::: ''mount --bind /mmc/jffs /jffs''
-[http://buy-soma.24us.info/ buy soma]+:* with v24 enable JFFS2 support (tab: Administration -> tab: Management -> section: JFFS2 Support)
-[http://buy-carisoprodol.24us.info/ buy carisoprodol]+:: or command ''nvram set sys_enable_jffs2=1''
-[http://buy-ultram.24us.info/ buy ultram]+:* To use ipkg also create folder /jffs/tmp/ipkg
-[http://ultram.ijijiji.com/ buy ultram]+:::''mkdir /jffs/tmp''
-[http://vicodin.ijijiji.com/ buy vicodin]+:::''mkdir /jffs/tmp/ipkg''
-[http://carisoprodol.ijijiji.com/ buy carisoprodol]+* For Windows: [[WinSCP]] can be used to transfer files to and from the router, eliminating the need to pull the card out and put it in a card reader on a PC.
-[http://xenical.ijijiji.com/ buy xenical]+* For Linux, Mac OS X: Other SCP transfer applications exist.
-[http://fioricet.ijijiji.com/ buy fioricet]+* Removed cards can be accessed natively in Linux or OS X, or on Windows with the Ext2FS driver ([http://www.fs-driver.org] or [http://ext2fsd.sourceforge.net]).
-[http://ambien.ijijiji.com/ buy ambien]+* On older firmware (v2.3), the limited JFFS space can be used to hold the drivers to load support for the SD card.
-[http://cialis.ijijiji.com/ buy cialis]+ 
-[http://soma.ijijiji.com/ buy soma]+ 
-[http://viagra1.ijijiji.com/ buy viagra]+== Add USB Storage ==
-[http://phentermine1.ijijiji.com/ buy phentermine]+* Routers with USB storage like [[Linksys WRTSL54GS]] or [[ASUS WL-500g Premium]] can have firmware with built-in USB support and then /jffs mounted on the USB device. To enable USB on these devices see: [[USB_storage]]
-[http://adipex1.ijijiji.com/ buy adipex]+** V24 and later firmware: USB support is available within Mega and some Mini builds.
-[http://xanax1.ijijiji.com/ buy xanax]+ 
-[http://tramadol1.ijijiji.com/ buy tramadol]+*Using V24SP1 Mega on an Asus WL-500W with external USB HDD:
-[http://hydrocodone1.ijijiji.com/ buy hydrocodone]+ 
-[http://meridia.ijijiji.com/ buy meridia]+:To mount the USB drive, and enable /jffs
-[http://alprazolam.ijijiji.com/ buy alprazolam]+ mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
-[http://buy-viagra.ca.tf/ buy viagra]+ mkdir /mnt/jffs
-[http://buy-phentermine.ca.tf/ buy phentermine]+ mount /mnt/jffs /jffs
-[http://buy-ambien.ca.tf/ buy ambien]+ 
-[http://buy-adipex1.ca.tf/ buy adipex]+*Also enable JFFS2 support in either web-GUI (tab: Administration -> tab: Management -> section: JFFS2 Support)
-[http://buy-xanax.ca.tf/ buy xanax]+: or with the command
-[http://buy-xenical.ca.tf/ buy xenical]+ nvram set sys_enable_jffs2=1
-[http://buy-tramadol.ca.tf/ buy tramadol]+*To use ipkg also create folder /jffs/tmp/ipkg
-[http://buy-hydrocodone.ca.tf/ buy hydrocodone]+ mkdir /jffs/tmp
-[http://buy-carisoprodol.ca.tf/ buy carisoprodol]+ mkdir /jffs/tmp/ipkg
-[http://buy-valium.ca.tf/ buy valium]+ 
-[http://buy-cialis.ca.tf/ buy cialis]+==Using [[CIFS]] (Client Samba): Storing ''/jffs'' content remotely==
-[http://buy-soma.ca.tf/ buy soma]+One option is to create a share on the network and mount it on the router at ''/jffs'' using [[CIFS]]. Exact steps at [[CIFS]]
-[http://buy-fioricet.ca.tf/ buy fioricet]+ 
-[http://buy-ultram.ca.tf/ buy ultram]+Overview:
-[http://buy-vicodin.ca.tf/ buy vicodin]+* Enable JFFS in the web-GUI or put the following command in a Script or Startup Command.
-[http://buy-meridia.ca.tf/ buy meridia]+ nvram set sys_enable_jffs2=1
-[http://buy-alprazolam1.ca.tf/ buy alprazolam]+* Create a share on a CIFS-capable server called ''jffs''.
-[http://hk852.to/viagra1/ buy viagra]+** Standard Microsoft Windows Shared Folder
-[http://hk852.to/ambien1/ buy ambien]+** Other operating systems may refer to SMB or Samba
-[http://hk852.to/phentermine1/ buy phentermine]+* In the Web GUI mount the [[CIFS]] share at ''/jffs''.
-[http://hk852.to/adipex1/ buy adipex]+* Folder ''/jffs'' appears locally, while
-[http://hk852.to/xanax/ buy xanax]+: Content actually saved remotely, on
-[http://hk852.to/xenical/ buy xenical]+:* NAS (Network Attached Storage)
-[http://hk852.to/cialis1/ buy cialis]+:* Server (PC or some type of file server)
-[http://hk852.to/fioricet1/ buy fioricet]+* To use ipkg also create folder /jffs/tmp/ipkg
-[http://hk852.to/valium1/ buy valium]+::''mkdir /jffs/tmp''
-[http://hk852.to/ultram1/ buy ultram]+::''mkdir /jffs/tmp/ipkg''
-[http://hk852.to/vicodin1/ buy vicodin]+'''Costs:'''
-[http://hk852.to/meridia1/ buy meridia]+* ! Setting up a NAS or Server only for router maybe not economical.
-[http://hk852.to/soma1/ buy soma]+** Equipment Costs: Requires existing NAS or PC Server
-[http://hk852.to/carisoprodol/ buy carisoprodol]+** Electricity Costs: if entire Server is only serving router
-[http://hk852.to/tramadol1/ buy tramadol]+* Availability Demands: CIFS share must be available
-[http://hk852.to/hydrocodone1/ buy hydrocodone]+** 24/7, or whenever the DD-WRT Device is on, and
-[http://hk852.to/alprazolam/ buy alprazolam]+** Storing JFFS Share on quality equipment is required (i.e. Raid, Power Backup)
-[http://free-ringtones.ca.tf/ free ringtones]+*** ! Remote storage down means /jffs down, could mean DD-WRT Device down (increases the weak points).
-[http://cell-phone-ringtones.ca.tf/ cell phone ringtones]+* Security Limitations: CIFS is limited to Microsoft's SMB protocol, offering up to only 128-bit security.
-[http://nextel-ringtones.ca.tf/ nextel ringtones]+** Poor Microsoft Protocol Security is not a problem if the LAN is physically and electronically protected from outside or inside intrusion (i.e. Guards, Guns, Locks, Dogs, Mines, Cameras, Firewalls)
-[http://98.to/viagra1/ buy viagra]+* LAN Connection Required: NAS cannot be wirelessly attached to DD-WRT Device.
-[http://98.to/phentermine2/ buy phentermine]+* Hassle: Using Microsoft Windows as the ''jffs'' Server
-[http://98.to/ambien1 buy ambien]+** ! Symbolic links in ''/jffs'' may not work.
-[http://98.to/adipex2/ buy adipex]+** ! Rename (mv) commands on the ''/jffs'' mount may not work.
-[http://98.to/xanax1/ buy xanax]+ 
-[http://98.to/xenical1/ buy xenical]+'''Most people only own an (inexpensive) Windows PC. A common Desktop PC does not a 24/7 Server make.'''
-[http://98.to/cialis1/ buy cialis]+ 
-[http://98.to/fioricet1/ buy fioricet]+ 
-[http://98.to/valium1/ buy valium]+'''The following non-updated (as of 20080520) examples may be out of date:'''
-[http://98.to/tramadol1/ buy tramadol]+* CIFS was broken on many builds this update author tried. Although other people have reported it working - It may be a limitation of ''BusyBox'' CIFS when using NTLMv2 and 128-bit encryption.
-[http://98.to/carisoprodol1/ buy carisoprodol]+* (Mostly) only structural and spelling mistakes were corrected below (20080522)
-[http://98.to/soma1/ buy soma]+ 
-[http://98.to/ultram1/ buy ultram]+===Use a Startup Script: Example 1===
-[http://98.to/hydrocodone2/ buy hydrocodone]+# Read how to use [[Startup Scripts]]. Then place the following into your startup script to mount the JFFS partition:
-[http://98.to/vicodin1/ buy vicodin]+ 
-[http://98.to/meridia1/ buy meridia]+ umount /jffs #unmounts existing /jffs if existing
-[http://98.to/alprazolam1/ buy alprazolam]+ mount.cifs //<server's IP>/jffs /jffs -o username=<the username>,password=<the password>
-[http://adipex.ca.tf/ adipex]+ nvram set sys_enable_jffs2=1 # fake-enable JFFS. Enable but do not commit. Makes ipkg think jffs2 is enabled.
-[http://xanax.ca.tf/ xanax]+ 
-[http://lipitor.ca.tf/ lipitor]+NOTE: Username is ''Guest'' when hosted on Windows XP & 'Simple File Sharing' is enabled - This is the default on Windows XP Home.
-[http://buy-viagra.us.tf/ buy viagra]+ 
-[http://buy-phentermine.us.tf/ buy phentermine]+===Use Startup Scripts: Example 2===
-[http://buy-ambien.us.tf/ buy ambien]+This method uses 2 scripts: The first will be started from /tmp/smbshare & mount the samba share under /jffs and start the other script. The second will be started from /jffs and unmount /tmp/sambashare.
-[http://buy-adipex.us.tf/ buy adipex]+ 
-[http://buy-xanax.us.tf/ buy xanax]+Instructions:
-[http://buy-xenical.us.tf/ buy xenical]+ 
-[http://buy-tramadol.at.tf/ buy tramadol]+# Enable [[CIFS]] (see also [[Jffs_sharing_in_a_Linux_server]]).
-[http://buy-hydrocodone.at.tf/ buy hydrocodone]+# Create a script called "startup.smb.sh" on the share:
-[http://buy-carisoprodol.at.tf/ buy carisoprodol]+ 
-</div>+ #!/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.
 + echo "umounting /jffs if necessary..." >> $SMBLOG
 + umount /jffs >> $SMBLOG 2>&1
 +
 + #mount our smbshare at /jffs
 + echo "mounting $SMBSHARE at /jffs..." >> $SMBLOG
 + mount.cifs $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:<br>
 + #!/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 create a /jffs at Startup.
 + nvram set sys_enable_jffs2=1
 +
 + #ready to do specific stuff, like starting services
 + #or other commands from /jffs
 +
 +5. in the webinterface, enable [[CIFS]] with appropriate share/user/pass settings from step 2.<br>
 +* Enter "startup.smb.sh" as the script<br>
 +6. Apply Changes<br>
 +7. reboot<br>
 +<br>
 +Now you should have the share configured in the web interface mounted at /jffs and should also be able to run 'ipkg' !
 + 
 +*NOTE: If you are a Linux newbie, and you have problems with file permissions, look at [http://wrt-wiki.bsr-clan.de/index.php?title=Jffs_sharing_in_a_Linux_server this ]
 + 
 +*Script files must be saved in UNIX format, not DOS. Windows editors that can do this are UltraEdit. EditPadPro and Crimson Editor, are free.
 +*[[WinSCP]] can be used to easily change the execute flags on the scripts.
 + 
 +===Use Startup Script: Example 3 ===
 +This method requires 2 shares available for DD-WRT, but allows you to have 2 different areas of storage for the router. Some might find it useful. It is an amalgamation of the previous 2 methods.
 + 
 +Things you need:
 + 
 +* 2 writeable shares on an NAS or Server.
 + 
 +Procedure:
 + 
 +1. Enable [[CIFS]]<br />
 +2. Create a shell script in the network share, as follows:<br />
 + 
 + #!/bin/sh
 + nvram set sys_enable_jffs2=1 # fake-enable JFFS
 + umount /jffs # unmount /jffs if it exists
 + mount.cifs //<server's IP>/<jffs share name> /jffs -o username=<your username>,password=<your password>
 + 
 +3. Enter the name of the script in the CIFS-Samba startup script box in the Web Interface.<br>
 +4. Apply changes.<br>
 +5. Reboot
 + 
 +As an example network setup:
 + 
 +* '''/tmp/smbshare''' located in a shared folder on the NAS called '''ddwrt''', which contains scripts (including '''startup.sh''' containing the above commands), yet to be installed packages and other static data
 +* '''/jffs''' located in a shared folder called '''jffs''', which contains program data for installed packages
 + 
 += Testing [[ipkg]]=
 +'''NOTE: [https://svn.dd-wrt.com/changeset/52896 Builds after 52894 do not have the ipkg binary included as it has long been deprecated].'''<br>
 +'''NOTE: Entware is more up-to-date than the (previously) included ipkg binary: [[Installing_Entware-3X|Installing Entware-3X]]'''
 + 
 +Log in to the CLI (via Telnet or SSH) and enter the following commands:<br>
 + cd /jffs
 + mkdir -p /jffs/tmp/ipkg
 + ipkg update
 + ipkg list
 +It is recommended that you reboot the router after running the above commands.
 + 
 +[[Category:Advanced end user]]
 +[[Category:Advanced tutorials]]

Current revision


NOTE: Use USB storage if your router has USB port. Read USB Storage guide by egc.

Contents


[edit] Introduction

Journalling Flash File System (JFFS/JFFS2) is a re-writable area within a DD-WRT-enabled device.

  • Located in /jffs.

Contents stored:

  • On DD-WRT Device main flash directly on the device (/jffs), or
  • mount --bind /storagelocation /jffs.
    Where storagelocation is
    • Off-board supplemental flash, see SD/MMC_mod, (/mmc/jffs).
    • Network Area Storage [NAS], or Server. (//servername/sharename)
    • JFFS reports as it's own free space, the free space on Share or SD Card, in the Web Interface

Examples of the kind of programs and data are:

  • Custom configuration files
  • NoCat splash pages and configuration
  • ipkg (Requires JFFS. See ipkg.)
  • Web-site hosting
  • Many other things.
  • JFFS must be Enabled for certain /jffs-dependent applications.


[edit] Enable JFFS: Create /jffs

[edit] Prerequisites

To enable JFFS you will need a router with at least 4MB flash, a build that supports JFFS such as the Mini build which is the smallest build to support JFFS thus leaving the most space for the JFFS partition, and your build must leave at least 324KB of flash free for the JFFS file system structure which will not be usable space. v24 pre-SP2 Standard builds no longer leave enough space for JFFS on 4MB devices so use the Mini build or one of Eko's specialty builds.

Very old versions of some Linksys routers (no longer manufactured for many years) contained 8MB of Flash and 32MB of RAM, many DD-WRT-capable devices today contain 4MB of Flash memory; a few models from certain manufacturers contain more flash (La Fonera, ASUS WL-500GP), some contain less (2MB). See Supported Devices.

Note that DD-WRT v24sp1 VPN builds have the JFFS feature removed, presumably due to conflicts that Brainslayer found between JFFS and bandwidth monitoring. See this thread for more information. Users interested in v24sp2 can opt:

  1. Use a build other than VPN, both MINI and MEGA still have JFFS
  2. Use an older build of DD-WRT
  3. Use a custom build, either homemade or dd-wrt.v24-10086_NEWD_openvpn_jffs_small.bin, which is described here as missing "snmp, all languages, some GUI styles and more.".

[edit] NOTE FOR ASUS WL500W

As of October 7th, 2009, consider the following or you may BRICK your WL500W router:

  • Brainslayers mega flash size - 7.33MB
  • Eko's Big Flash size - 5.9MB

Now, the error only occurs when JFFS2 is enabled and the router reboots, so you are safe if you DONT enable JFFS2.

Total available JFFS2 size for BS's build is 640KB which overwhelms the kernel and causes a panic. Even using a storage device with the command mount -o bind /mnt/jffs /jffs will still cause a kernel panic.

Eko's JFFS2 partition size is 1640KB+, allowing much more room.

I tested this on BS's 12996,12874 and 12533 builds and partially bricked my router several times. (A simple power disconnect for 30 secs will allow it to recover)

Eko's build however works flawlessly AND provides the SAME features (except for connection warning) as BS's.

One thing I am still unsure of is why this particular model Asus router is subject to this bug, but in the mean time, I suggest using Eko's Big build until the dev's can work it out..

[edit] Flash Wear: A Warning

Take care not to store frequently changing files (i.e. often-changing log files) on Flash as this can cause flash wear-out over time.

  • A journalling flash file system is specifically designed to minimize frequent overwrites.
  • Files which are read many times but written infrequently work well on main flash.
  • Using the space provided by SD/MMC_mod places wear on replaceable secondary flash storage.


[edit] Directions for (normal) users: using Web-GUI Interface

The steps to enable JFFS through the router web page are very specific. To avoid having to reset and reprogram your router, it's smart to make a backup here of your settings. If you follow these steps exactly, it should not lock up.

  1. On the router web page click on Administration.
  2. Scroll down until you see JFFS2 Support section.
  3. Click Enable JFFS.
  4. Click Save.
  5. Wait couple seconds, then click Apply.
  6. Wait again. Go back to the Enable JFFS section, and enable Clean JFFS.
  7. Do not click "Save". Click Apply instead.

    The router formats the available space.

  8. Wait till you get the web-GUI back, then disable "Clean JFFS" again.
  9. Click "Save".
  10. It may be wise to Reboot the router, just to make sure

If you don't see the Enable JFFS option on your Administration page, it is likely because your router has insufficient flash memory to hold both DD-WRT and a JFFS partition. If you have a 4MB router, you may be able to work around this by using the mini version of DD-WRT

[edit] Directions for (freaky) Linux Gurus: CLI

WARNING

A user comments: I tried the following commands under La Fonera firmware v24 RC4 and corrupted all my settings. I had to recover my unit with the procedures on La Fonera flashing page. I am not sure if this is a bug or these commands are not suited for La Fonera. Please try to use the web interface above. It works for me.

Enter the following commands from the CLI:

nvram set jffs_mounted=1
nvram set enable_jffs2=1
nvram set sys_enable_jffs2=1
nvram set clean_jffs2=1
nvram set sys_clean_jffs2=1
nvram commit
reboot


Note: Device might reboot/hang after cleaning which might take long; be patient.

To unmount the JFFS:

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

Afterwards you can delete these variables with "nvram unset <variable>".

[edit] Options for Increasing JFFS Space

[edit] Add a 1GB flash memory card

  • Add the SD/MMC mod
    • up to (at least) 1GB storage using common swappable SD memory cards (built-in support with DD-WRT v2.4 and later).
    • create the folder /mmc/jffs
mkdir /mmc/jffs
  • Use the Mount Bind command to point /jffs to the storage card:
mount --bind /mmc/jffs /jffs
  • with v24 enable JFFS2 support (tab: Administration -> tab: Management -> section: JFFS2 Support)
or command nvram set sys_enable_jffs2=1
  • To use ipkg also create folder /jffs/tmp/ipkg
mkdir /jffs/tmp
mkdir /jffs/tmp/ipkg
  • For Windows: WinSCP can be used to transfer files to and from the router, eliminating the need to pull the card out and put it in a card reader on a PC.
  • For Linux, Mac OS X: Other SCP transfer applications exist.
  • Removed cards can be accessed natively in Linux or OS X, or on Windows with the Ext2FS driver ([1] or [2]).
  • On older firmware (v2.3), the limited JFFS space can be used to hold the drivers to load support for the SD card.


[edit] Add USB Storage

  • Routers with USB storage like Linksys WRTSL54GS or ASUS WL-500g Premium can have firmware with built-in USB support and then /jffs mounted on the USB device. To enable USB on these devices see: USB_storage
    • V24 and later firmware: USB support is available within Mega and some Mini builds.
  • Using V24SP1 Mega on an Asus WL-500W with external USB HDD:
To mount the USB drive, and enable /jffs
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
mkdir /mnt/jffs
mount /mnt/jffs /jffs
  • Also enable JFFS2 support in either web-GUI (tab: Administration -> tab: Management -> section: JFFS2 Support)
or with the command
nvram set sys_enable_jffs2=1
  • To use ipkg also create folder /jffs/tmp/ipkg
mkdir /jffs/tmp
mkdir /jffs/tmp/ipkg

[edit] Using CIFS (Client Samba): Storing /jffs content remotely

One option is to create a share on the network and mount it on the router at /jffs using CIFS. Exact steps at CIFS

Overview:

  • Enable JFFS in the web-GUI or put the following command in a Script or Startup Command.
nvram set sys_enable_jffs2=1
  • Create a share on a CIFS-capable server called jffs.
    • Standard Microsoft Windows Shared Folder
    • Other operating systems may refer to SMB or Samba
  • In the Web GUI mount the CIFS share at /jffs.
  • Folder /jffs appears locally, while
Content actually saved remotely, on
  • NAS (Network Attached Storage)
  • Server (PC or some type of file server)
  • To use ipkg also create folder /jffs/tmp/ipkg
mkdir /jffs/tmp
mkdir /jffs/tmp/ipkg

Costs:

  •  ! Setting up a NAS or Server only for router maybe not economical.
    • Equipment Costs: Requires existing NAS or PC Server
    • Electricity Costs: if entire Server is only serving router
  • Availability Demands: CIFS share must be available
    • 24/7, or whenever the DD-WRT Device is on, and
    • Storing JFFS Share on quality equipment is required (i.e. Raid, Power Backup)
      •  ! Remote storage down means /jffs down, could mean DD-WRT Device down (increases the weak points).
  • Security Limitations: CIFS is limited to Microsoft's SMB protocol, offering up to only 128-bit security.
    • Poor Microsoft Protocol Security is not a problem if the LAN is physically and electronically protected from outside or inside intrusion (i.e. Guards, Guns, Locks, Dogs, Mines, Cameras, Firewalls)
  • LAN Connection Required: NAS cannot be wirelessly attached to DD-WRT Device.
  • Hassle: Using Microsoft Windows as the jffs Server
    •  ! Symbolic links in /jffs may not work.
    •  ! Rename (mv) commands on the /jffs mount may not work.

Most people only own an (inexpensive) Windows PC. A common Desktop PC does not a 24/7 Server make.


The following non-updated (as of 20080520) examples may be out of date:

  • CIFS was broken on many builds this update author tried. Although other people have reported it working - It may be a limitation of BusyBox CIFS when using NTLMv2 and 128-bit encryption.
  • (Mostly) only structural and spelling mistakes were corrected below (20080522)

[edit] Use a Startup Script: Example 1

  1. Read how to use Startup Scripts. Then place the following into your startup script to mount the JFFS partition:
umount /jffs #unmounts existing /jffs if existing
mount.cifs //<server's IP>/jffs /jffs -o username=<the username>,password=<the password>
nvram set sys_enable_jffs2=1 # fake-enable JFFS. Enable but do not commit. Makes ipkg think jffs2 is enabled.

NOTE: Username is Guest when hosted on Windows XP & 'Simple File Sharing' is enabled - This is the default on Windows XP Home.

[edit] Use Startup Scripts: Example 2

This method uses 2 scripts: The first will be started from /tmp/smbshare & mount the samba share under /jffs and start the other script. The second will be started from /jffs and unmount /tmp/sambashare.

Instructions:

  1. Enable CIFS (see also Jffs_sharing_in_a_Linux_server).
  2. 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.
echo "umounting /jffs if necessary..." >> $SMBLOG
umount /jffs >> $SMBLOG 2>&1

#mount our smbshare at /jffs
echo "mounting $SMBSHARE at /jffs..." >> $SMBLOG
mount.cifs $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 create a /jffs at Startup.
nvram set sys_enable_jffs2=1

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

5. in the webinterface, enable CIFS with appropriate share/user/pass settings from step 2.

  • Enter "startup.smb.sh" as the script

6. Apply Changes
7. reboot

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

  • NOTE: If you are a Linux newbie, and you have problems with file permissions, look at this
  • Script files must be saved in UNIX format, not DOS. Windows editors that can do this are UltraEdit. EditPadPro and Crimson Editor, are free.
  • WinSCP can be used to easily change the execute flags on the scripts.

[edit] Use Startup Script: Example 3

This method requires 2 shares available for DD-WRT, but allows you to have 2 different areas of storage for the router. Some might find it useful. It is an amalgamation of the previous 2 methods.

Things you need:

  • 2 writeable shares on an NAS or Server.

Procedure:

1. Enable CIFS
2. Create a shell script in the network share, as follows:

#!/bin/sh
nvram set sys_enable_jffs2=1 # fake-enable JFFS
umount /jffs # unmount /jffs if it exists
mount.cifs //<server's IP>/<jffs share name> /jffs -o username=<your username>,password=<your password>

3. Enter the name of the script in the CIFS-Samba startup script box in the Web Interface.
4. Apply changes.
5. Reboot

As an example network setup:

  • /tmp/smbshare located in a shared folder on the NAS called ddwrt, which contains scripts (including startup.sh containing the above commands), yet to be installed packages and other static data
  • /jffs located in a shared folder called jffs, which contains program data for installed packages

[edit] Testing ipkg

NOTE: Builds after 52894 do not have the ipkg binary included as it has long been deprecated.
NOTE: Entware is more up-to-date than the (previously) included ipkg binary: Installing Entware-3X

Log in to the CLI (via Telnet or SSH) and enter the following commands:

cd /jffs
mkdir -p /jffs/tmp/ipkg
ipkg update
ipkg list

It is recommended that you reboot the router after running the above commands.