What's new

Be Prepared

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ApexRon

Very Senior Member
Last night I learned a lesson the hard way. In attempting to resolve a minor (my fault) issue, the configuration got corrupted and I lost WiFi. Fortunately I was able to perform a factory reset and recover though I had to reconfigure.

I recommend that you are prepared should your router get 'stupid'. I now have a working copy of my configuration and two versions of firmware on my laptop. This way I will be able to recover from future FUBARs.
 
And you have a backup of the laptop? I keep my router configs and firmware on Google Drive which syncs to laptop, desktop, iMac and etc. Just in case...

Sent from my SM-T380 using Tapatalk
 
And you have a backup of the laptop? I keep my router configs and firmware on Google Drive which syncs to laptop, desktop, iMac and etc. Just in case...

Sent from my SM-T380 using Tapatalk
Laughing at myself. My laptop backup is on the USB drive of router. But then my laptop is a MacBook and in 10 years, with one upgrade, I’ve never had to use a backup except for upgrade. My work Windoze laptop would crash if you looked at it wrong.
 
I routinely save my settings - especially after making changes in dhcp_staticlist and custom client names.
What I'm not sure of is whether the Settings file also contains the data in the json files in /jffs. IIRC, this is stuff that was moved from nvram by ASUS. Note that this may be hardware dependent depending of each model's available static RAM.
 
Thanks for the reminder. I had setup a crude script to save settings, but only today discovered that cronjobs aren’t preserved across reboots, so I had to learn from the Merlin wiki how to persist the cronjobs. Sharing my crude scripts as a starting point for anyone needing a leg up. Also included a JFFS tarball after reading this thread.

I include the extendno variable in my filenames since I’m running John’s fork, but it probably isn’t meaningful enough on Merlin.

Code:
# cat /jffs/scripts/routerbackup.sh
#!/bin/sh
if [ -d /mnt/Backup/Router ]; then
        nvram save /mnt/Backup/Router/settings_$(nvram get extendno)_$(date +'%Y-%m-%d').cfg
        tar -czvf /mnt/Backup/Router/jffs_$(nvram get extendno)_$(date +'%Y-%m-%d').tar.gz /jffs
fi

Code:
# cat /jffs/scripts/init-start
#!/bin/sh

cru a routerbackup "45 3 * * Fri sh /jffs/scripts/routerbackup.sh"
 
You should probably change your post title to reflect what this post is about. Here are some suggestions:

  • Be prepared. Keep a configuration backup.
  • Always be prepared for possible config corruption.
  • Stupidity can waste a lot of time. Keep a config backup.
 
Thanks for the reminder. I had setup a crude script to save settings, but only today discovered that cronjobs aren’t preserved across reboots, so I had to learn from the Merlin wiki how to persist the cronjobs. Sharing my crude scripts as a starting point for anyone needing a leg up. Also included a JFFS tarball after reading this thread.

I include the extendno variable in my filenames since I’m running John’s fork, but it probably isn’t meaningful enough on Merlin.

Code:
# cat /jffs/scripts/routerbackup.sh
#!/bin/sh
if [ -d /mnt/Backup/Router ]; then
        nvram save /mnt/Backup/Router/settings_$(nvram get extendno)_$(date +'%Y-%m-%d').cfg
        tar -czvf /mnt/Backup/Router/jffs_$(nvram get extendno)_$(date +'%Y-%m-%d').tar.gz /jffs
fi

Code:
# cat /jffs/scripts/init-start
#!/bin/sh

cru a routerbackup "45 3 * * Fri sh /jffs/scripts/routerbackup.sh"

And you can ensure you only keep for example the last 30 days of backups:

Code:
find /Backup/Router/ -type f -name '*.gz' -mtime +30 -exec rm {} \;
 
Laughing at myself. My laptop backup is on the USB drive of router. But then my laptop is a MacBook and in 10 years, with one upgrade, I’ve never had to use a backup except for upgrade. My work Windoze laptop would crash if you looked at it wrong.
Weird. I've had my Windows laptop since I bought it in 2007 and my Windows desktop since I built it in 2009 and neither have crashed yet in terms of hardware. The only thing that crashes Windows is on my desktop, where the very old graphics card drivers occasionally blue screen after about 6 months of uptime. I guess it depend on the quality of the hardware that the manufacturer uses.

For backup purposes you can't go wrong with a good NAS device with a robust filesystem like ZFS. Then you don't have to trust Google or anybody else with sensitive information, and you can backup much faster over a 1GB LAN than uploading through your ISP. If you VPN to your router, you can access everything securely and remotely as well. You can even install OwnCloud on a system like FreeNAS and have your own service that works similarly to Google Cloud. If you're really paranoid you can also set up a remote NAS box and use replication to sync it to your home NAS.
 
Code:
find /Backup/Router/ -type f -name '*.gz' -mtime +30 -exec rm {} \;
Thanks, but unless I'm missing something the find version on my router doesn't seem to recognise the "-type f" argument... Are there any issues with just removing it?
Thanks also to @dave14305 for his script.
 
Thanks, but unless I'm missing something the find version on my router doesn't seem to recognise the "-type f" argument... Are there any issues with just removing it?

Probably not, unless you have directories within that backup folder. I only did a quick test run of the command I usually use on other servers, to ensure it at least understood the -mtime parameter.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top