Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am newbie to this. I have got dd-wrt , installed and configured in my router.

dd-wrt version : DD-WRT v24-sp2 (08/07/10) router version : D-Link DIR 600

I am trying setup bandwidth usage monitoring script in it.

Is there any way , I can store details in router , without getting deleted on reboot ?

I mean is there some kind of persistent storage I can get ?

Thanks
J

share|improve this question
    
As far as I remember, DD-WRT splits the flash into part for the read-only partition with the system that gets loaded into RAM and decompressed and then used and a small part used for settings storage that could be written to. You could try using that for as storage space. The problem comes up if you need to install an additional program to the router to do the monitoring because there will be little space left. When I had such a problem, in the end I had to move to OpenWRT which doesn't use read-only filesystem. –  AndrejaKo Jan 20 '12 at 8:19
add comment

4 Answers

There should be nvram (i.e. non-volatile ram).

nvram show            # list all variables
nvram get name        # get variable
nvram set name=value  # set variable
nvram unset name      # delete variable
nvram commit          # save changes to flash
share|improve this answer
add comment

There is a small space that you can use. I don't know exactly because I didn't look up your router's specs. When you set a cron job you are writing to the filesystem are you not? I would SSH in and check out the /var directory. If you have a usb port you could place your log files there. Just be sure in your script to delete the logs once they get a certain size or your router will die.

This might interest you http://www.dd-wrt.com/wiki/index.php/Useful_Scripts or this forum thread. http://www.dd-wrt.com/phpBB2/viewtopic.php?t=81432

share|improve this answer
add comment

Usually there is some space you can use. For example read this answer: http://stackoverflow.com/questions/451638/list-free-flash-space-on-wrt54gl-with-dd-wrt-v24sp1-firmare. In my WAG200G I formated mtd2 or mtd3 for my purpose. But you need to be sure which flash block you can use otherwise you can turn your device to a brick.

share|improve this answer
add comment

As Mika said: nvram is the name of the persistent storage. Unfortunately, it is not a file system. The file system of DD-WRT (at least the small ones) is a combination of squashfs and ramfs and is populated at boot time from values stored in nvram.

When you go to Administration->Commands, you can enter a script and save it as a Custom Script (bottom of the page). You can use this feature to implement several use cases, provided that they are all in this single script. I made something like this:

case "$1" in
  wificontrol)
    #here is code which turns off wlan after 30 mins of inactivity
    ;;

  wifion|wifi)
    wlanIF=ra0
    ifconfig $wlanIF up
    touch /tmp/wlan-online0
    ;;

  *)
    echo "$0 {wificontrol|wifi[on]}"
esac

Then, I run the script on command line:

/tmp/custom.sh wifion

And as a cron job (Administration->Management):

*/4 * * * * root /tmp/custom.sh wificontrol

I know, this is not a very nice solution, but it works. Tested on my v24-sp2 (rev 14896)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.