NVRAM [Release] NVRAM Save/Restore Utility

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Xentrk

Part of the Furniture
Maybe this is because I saved and restored on the latest (384.18) Merlin, but when I did so, everything seemed to be OK, with a few exceptions:
- the custom traffic stats location was lost and went to the default ram location
- custom scripts were disabled even though I had them enabled prior to save/factory-reset/restore.
(RT-AC68U)
The jffs custom scripts has to be manually configured after a factory reset and before running the utility. I thought I had mentioned this in the README but it doesn't look like it. I will add it to the documentation. I'll look into the custom traffic stats location. I don't use that feature so it wasn't something I noticed an issue with during my testing.
 

ttgapers

Senior Member
Here is the systembackup.sh script I use. I amended from this forum when this script was manual. @Xentrk I haven't used your installer - but used your updates due to this. So here it is for the community's use and perhaps amended to your release!!

Code:
#!/bin/sh

UTIL=nvram
BLOC=/mnt/<usb-label>/$UTIL
BARC=$BLOC/archive
BKUP=$BLOC/backup
RETENTION=7

CRUNAME=$UTIL
cru l | grep $CRUNAME >/dev/null || cru a $CRUNAME "0 5 * * * $0 $*"

#exit if directory doesn't exist or not mounted.
[[ -d "$BLOC" ]] || exit 1
[[ -d "$BKUP" ]] && rm -rf $BKUP
[[ -d "$BKUP" ]] || mkdir $BKUP
cd "$BLOC"

/mnt/<usb-label>/nvram/nvram-save.sh -clk -b
#mv "$BKUP" "$BKUP.$(date +"%F_%T")"
sleep 30
mv "$BKUP" "$BKUP.$(hostname).$(date +%Y%m%d%H%M)"
mv "$BKUP.$(hostname).$(date +%Y%m%d%H%M)" "$BARC"


#careful here.  You do not want this running if ntp hasn't synced.
find $BARC -name "backup.$(hostname).20*" -mtime +$RETENTION -exec rm -rf {} \;


exit 0
It needs definition of the variables for
UTIL - name of your scripts folder
BLOC - backup location
BARC=Archive folder
BKUP= Backup folder (for current runs)
RETENTION= Retention period

I tie it together by having this in my service-start as the script above creates the scheduled task:

Code:
# Add NVRAM backup job & run retention
#/usr/sbin/cru a Backup "0 5 * * * /tmp/mnt/sauron-usb/nvram/nvram-save.sh"
/jffs/scripts/systembackup.sh
Hope you find it useful....I think it was in the original nvram thread...

I've tweaked and published the script here: https://github.com/ttgapers/backup-merlin

Anyone care/want to use it, please be my guest!
 

Xentrk

Part of the Furniture

Xentrk

Part of the Furniture
nvram-save.sh patch available - 11 July 2020

nvram-save.sh has been patched to fix issue reported by @ech


To exclude an nvram setting from being saved during a migration save, or restored during a migration restore, prefix it with a @ in nvram-merlin.ini. The code was not processing these variables for a normal backup save/restore.

Following are the variables in the nvram-merlin.ini file that were being skipped in error during backup save/restore.
@AllLED
@jffs2_enable
@jffs2_exec
@jffs2_format
@jffs2_on
@jffs2_scripts
@https_crt_cn
@https_crt_file
@https_crt_gen
@https_crt_save
@lan_hostname
@usb_usb2
@usb_usb3
@usb_idle_exclude
@usb_idle_timeout
@rstats_bak
@rstats_colors
@rstats_data
@rstats_enable
@rstats_exclude
@rstats_new
@rstats_offset
@rstats_path
@rstats_sshut
@rstats_stime
@cstats_all
@cstats_enable
@cstats_exclude
@cstats_include
@cstats_new
@cstats_sshut
@led_disable
@btn_ez
@btn_ez_mode
@btn_ez_radiotoggle
@btn_led
@btn_led_gpio
@btn_led_mode
@btn_lte
@btn_rst
@btn_wifi_sw
@btn_wifi_toggle
@gro_disable
@diskmon_force_stop
@diskmon_freq
@diskmon_freq_time
@diskmon_part
@diskmon_policy
@diskmon_status
@diskmon_usbport
@usb_path1_diskmon_freq
@usb_path1_diskmon_freq_time
@usb_path2_diskmon_freq
@usb_path2_diskmon_freq_time
@usb_path3_diskmon_freq
@usb_path3_diskmon_freq_time
@wl0_reg_mode
@wl0_txpower
@wl0_TxPower
@wl1_reg_mode
@wl1_txpower
@wl1_TxPower
@wl2_reg_mode
@wl2_txpower
@wl2_TxPower
@acs_band3
@acs_ch13
@daapd_friendly_name
@dms_friendly_name
@computer_name

Update:
Type nsrum on the command line to access the menu. Select option

[2] Check for updates to existing installation

to get the new version. Run nvram-save.sh to get a fresh backup.
 

visortgw

Senior Member
nvram-save.sh patch available - 11 July 2020

nvram-save.sh has been patched to fix issue reported by @ech


To exclude an nvram setting from being saved during a migration save, or restored during a migration restore, prefix it with a @ in nvram-merlin.ini. The code was not processing these variables for a normal backup save/restore.

Following are the variables in the nvram-merlin.ini file that were being skipped in error during backup save/restore.
@AllLED
@jffs2_enable
@jffs2_exec
@jffs2_format
@jffs2_on
@jffs2_scripts
@https_crt_cn
@https_crt_file
@https_crt_gen
@https_crt_save
@lan_hostname
@usb_usb2
@usb_usb3
@usb_idle_exclude
@usb_idle_timeout
@rstats_bak
@rstats_colors
@rstats_data
@rstats_enable
@rstats_exclude
@rstats_new
@rstats_offset
@rstats_path
@rstats_sshut
@rstats_stime
@cstats_all
@cstats_enable
@cstats_exclude
@cstats_include
@cstats_new
@cstats_sshut
@led_disable
@btn_ez
@btn_ez_mode
@btn_ez_radiotoggle
@btn_led
@btn_led_gpio
@btn_led_mode
@btn_lte
@btn_rst
@btn_wifi_sw
@btn_wifi_toggle
@gro_disable
@diskmon_force_stop
@diskmon_freq
@diskmon_freq_time
@diskmon_part
@diskmon_policy
@diskmon_status
@diskmon_usbport
@usb_path1_diskmon_freq
@usb_path1_diskmon_freq_time
@usb_path2_diskmon_freq
@usb_path2_diskmon_freq_time
@usb_path3_diskmon_freq
@usb_path3_diskmon_freq_time
@wl0_reg_mode
@wl0_txpower
@wl0_TxPower
@wl1_reg_mode
@wl1_txpower
@wl1_TxPower
@wl2_reg_mode
@wl2_txpower
@wl2_TxPower
@acs_band3
@acs_ch13
@daapd_friendly_name
@dms_friendly_name
@computer_name

Update:
Type nsrum on the command line to access the menu. Select option

[2] Check for updates to existing installation

to get the new version. Run nvram-save.sh to get a fresh backup.
Error during update:

chmod: /nvram-save.sh: No such file or directory​

Not sure that it breaks anything as the save script appears to update and run to completion.
 

Goran

Occasional Visitor
Hi,
I am getting following error:
cp: can't create '/tmp/mnt/ASUS/nsru/backup/jffs-202007111858_RT-AC88U-E768/./.sys/WBL/wlist_m/"MAC address"': Inval id or incomplete multibyte or wide character
cp: can't create '/tmp/mnt/ASUS/nsru/backup/jffs-202007111858_RT-AC88U-E768/./.sys/WBL/blist_m/"MAC address"': Inval id or incomplete multibyte or wide character

where "MAC address" is MAC address of my kid's phone.

Is backup performed well because of this error?

Thank you.
 

Xentrk

Part of the Furniture
Error during update:

chmod: /nvram-save.sh: No such file or directory​

Not sure that it breaks anything as the save script appears to update and run to completion.
Does this command show the correct install location of NVRAM Save/Restore Utility?
Code:
ls -d -- /tmp/mnt/*/nsru
Change to the NVRAM Save/Restore location and type this to confirm the updated file downloaded correctly:
Code:
cat nvram-save.sh | grep "Version 30.3.1"
 

Xentrk

Part of the Furniture
Hi,
I am getting following error:
cp: can't create '/tmp/mnt/ASUS/nsru/backup/jffs-202007111858_RT-AC88U-E768/./.sys/WBL/wlist_m/"MAC address"': Inval id or incomplete multibyte or wide character
cp: can't create '/tmp/mnt/ASUS/nsru/backup/jffs-202007111858_RT-AC88U-E768/./.sys/WBL/blist_m/"MAC address"': Inval id or incomplete multibyte or wide character

where "MAC address" is MAC address of my kid's phone.

Is backup performed well because of this error?

Thank you.
I suspect it may have to do with the format of the USB drive. Is it NTFS format?
Run the command:
Code:
fdisk -l
What is listed under the "System" column heading? If it's ext2,3 or 4 format, it should say "Linux". The code saves to disk differently if saving to NTFS. So that may be where the issue is.

The command mount will show the format type for all mount points.
 
Last edited:

JonEngland

Regular Contributor
This is a difficult one to debug and find the root cause since there are no error messages. It just appears to stop writing to disk.

Have you run diagnostics on the attached storage? You can unmount the USB on the main page and run the Health Scanner to see if there are bad sectors. Or, manually run the 'e2fsck -p' command after unmounting the disk.
I was getting the same issue (I think it was since since upgrading to 384.18 but possibly a coincidence) and the point at which it hangs seems different each time. In example below I left it running for 30 mins but nothing happens and I saw no further log entries
upload_2020-7-13_19-34-9.png


disk check script shows output below
Running disk check v2.9, with command 'e2fsck -p' on /dev/sda1
SanDisk4GB: clean, 1868/244800 files, 340245/977408 blocks
Mon Jul 13 12:27:26 IST 2020 Disk check done on /dev/sda1

I then enabled USB 3.0 mode and plugged the usb stick in to the USB 3.0 port, re-ran the nvram-save script and it completed in no time at all, which was the first time it completed for me on this firmware version.
 
Last edited:

Xentrk

Part of the Furniture
I was getting the same issue (I think it was since since upgrading to 384.18 but possibly a coincidence) and the point at which it hangs seems different each time. In example below I left it running for 30 mins but nothing happens and I saw no further log entries
View attachment 24686

disk check script shows output below
Running disk check v2.9, with command 'e2fsck -p' on /dev/sda1
SanDisk4GB: clean, 1868/244800 files, 340245/977408 blocks
Mon Jul 13 12:27:26 IST 2020 Disk check done on /dev/sda1

I then enabled USB 3.0 mode and plugged the usb stick in to the USB 3.0 port, re-ran the nvram-save script and it completed in no time at all, which was the first time it completed for me on this firmware version.
Thanks for the information. Keep us updated.
 

brec

Regular Contributor
What is the relation between this utility and the GUI's "Save setting" and "Backup JFFS partition" functions? If I wanted to have an ability to clone my router in case my pet elephant steps on it, how would these two compare? I guess it's an issue of what nvram items are saved by "Save setting"?
 

Xentrk

Part of the Furniture
What is the relation between this utility and the GUI's "Save setting" and "Backup JFFS partition" functions? If I wanted to have an ability to clone my router in case my pet elephant steps on it, how would these two compare? I guess it's an issue of what nvram items are saved by "Save setting"?
Either utility will work for the situation you describe. The NVRAM Save/Restore Utility does not backup the router password since it is encrypted and not really required. Other than that, it is supposed to save all of the necessary nvram vars so you can recover from a disaster. Some people schedule cron jobs to run the NVRAM Save/Restore Utility. The firmware backup writes to your PC while the utility writes to USB disk.
 

cofetym

Regular Contributor
Xentrk does the Nvram Save/Restore Utility work on the Asus stock firmware?
 

Xentrk

Part of the Furniture
Xentrk does the Nvram Save/Restore Utility work on the Asus stock firmware?
The utility should work with stock firmware. I saw some references to OEM in the change log from the original author that infers support for stock. The extra nvram vars in asuswrt-merlin should be ignored. I don't recall anyone using it with stock though.

Test by using the built in save/restore option to make a backup. Then, do the same with the nvram save/restore utility. Factory reset and restore from the utility and test. If issues, restore from the file created by the firmware option.
 

morden

Regular Contributor
Will this work in migrating my latest firmwared RT-AC87 settings (SSID's, passwords, etc) to the RT-AX88u (firmware 384.19) that I am currently thinking of purchasing? Also, is there a feature to print out all my current router settings in the event something goes wrong with the migration and that I have to manually enter some settings?

Thanks,
Morden
 

joegreat

Very Senior Member
Will this work in migrating my latest firmwared RT-AC87 settings (SSID's, passwords, etc) to the RT-AX88u (firmware 384.19) that I am currently thinking of purchasing? Also, is there a feature to print out all my current router settings in the event something goes wrong with the migration and that I have to manually enter some settings?
Manual re-config is the save way forward. I was in the same situation recently as I upgraded my main router from AC87 to AX88.
To be able to look into the old and enter things into the new router, I dual-connected my notebook: via LAN to the new router (default IP is 192.168.50.1 - need to change network settings manually) and via WLAN to the old one - so I could see and copy/past thing between routers. Even Internet worked in this way to look-up things as needed.
 

Xentrk

Part of the Furniture
Will this work in migrating my latest firmwared RT-AC87 settings (SSID's, passwords, etc) to the RT-AX88u (firmware 384.19) that I am currently thinking of purchasing? Also, is there a feature to print out all my current router settings in the event something goes wrong with the migration and that I have to manually enter some settings?

Thanks,
Morden
There is a migration mode for migrating settings from one router to another.

sh nvram-save.sh -m

Then, run nvram-hnd-migr.sh if performing a migration from a non-HND router to an HND router (RT-AC86U and RT-AX88U). This script will create a script in the NVRAM Save/Restore Utility folder called restore-hnd-migr.sh. Run restore-hnd-migr.sh after running the scripts nvram-restore.sh and jffs-restore.sh on the HND router to copy the HND specific nvram parameters stored in the the /jffs/nvram directory.
 

morden

Regular Contributor
There is a migration mode for migrating settings from one router to another.

sh nvram-save.sh -m

Then, run nvram-hnd-migr.sh if performing a migration from a non-HND router to an HND router (RT-AC86U and RT-AX88U). This script will create a script in the NVRAM Save/Restore Utility folder called restore-hnd-migr.sh. Run restore-hnd-migr.sh after running the scripts nvram-restore.sh and jffs-restore.sh on the HND router to copy the HND specific nvram parameters stored in the the /jffs/nvram directory.
@Xentrk Thank you. A couple of quick questions, 1 - To do the nvram command usage, I would need to use a ext2 or 3 formatted USB stick correct? and 2 - What is a non-HND and/or HND router? Forgive my ignorance for not knowing the difference between the two are and how one would go about to know if their router is non-HND or HND?

Once again thanks!!

Cheers,
Morden
 

Xentrk

Part of the Furniture
@Xentrk Thank you. A couple of quick questions, 1 - To do the nvram command usage, I would need to use a ext2 or 3 formatted USB stick correct? and 2 - What is a non-HND and/or HND router? Forgive my ignorance for not knowing the difference between the two are and how one would go about to know if their router is non-HND or HND?

Once again thanks!!

Cheers,
Morden
Use the format disk (fd) utility in amtm to format the USB. Use the recommended settings suggested by the utility.

Non-HND are ARM CPU models.

HND CPU models are:
  • RT-AC86U (starting with version 382.1)
  • RT-AX88U
  • RT-AX56U
  • RT-AX58U
  • RT-AX3000 (same firmware as RT-AX58U)
 

Latest threads

Sign Up For SNBForums Daily Digest

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