Config & Stash restores


 

Tony L-Iowa

TVWBB Fan
So, I screwed up my config playing around with some wifi configuration scripts and I had to start over. This got me pondering a few things:

Is there a way to save off our 64MB config/stash region from end of uSD to a PC and restore it later? I notice configs appear to have a backup/restore but I didn't see the stash DB in that backup of /usr, /etc folder structure? Maybe I just need a partition manager for this? Can I save off one 64MB partition from one HeaterMeter and restore it to another? I have two HeaterMeter's and I want one as a backup to the other.

Another thing I was curious about as I went through the reimage and change of the cmdline.txt file to add "norestore" was alternatives to this method. I understand the configs are stored at the end of every boot. Would it be possible to save another config every month or every 30 boots to have as a secondary "golden" backup that could be restored by us changing the cmdline.txt file (e.g. instead of norestore we could add "restore30" or "restore_golden") for recovering settings that we didn't just butcher with a recent change.

Maybe I'm just getting carried away because I screwed up playing with the scripts to change wifi between client and AP modes... :)
 
I also just noticed my new scripts I manually put into /etc, /usr/bin, and /etc/init.d/ were not backed up as part of the "Generate archive" option on the backup menu.
 
Right, you have to register files to be included in the backup "generate archive" process by adding them to /etc/sysupgrade.conf. Stash files aren't included in this because stashing is sort of not very well fleshed out.

You could implement your own 30 boot configuration backup process with a shell script. The backup is created with the sysupgrade openwrt executable, which can generate a new tar backup. I wouldn't think this would be super useful normally though, because what generally happens is that someone screws up their configuration so bad that they can't get to the device at all so it's best to start from scratch again. For people like us who are messing with things until we break them, we have keyboards and monitors and the ability to do our own failsafe restores.

Once you have a good configuration, just sysupgrade store it on the 64MB partition. If you mess something up, just sysupgrade restore that backup using a keyboard. If you're feeling superfancy you can tie a button the a raspberry pi GPIO and make a boot shell script that checks for it and auto restores your failsafe config.
 

 

Back
Top