1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[Release] NVRAM Save/Restore Utility

Discussion in 'Asuswrt-Merlin' started by Xentrk, Feb 9, 2020.

  1. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    Utility to save/restore NVRAM values and the jffs partition on Asuswrt-Merlin firmware.

    Installation and usage instructions are available on the NVRAM Save/Restore Utility GitHub page with additional instructions in the project QuickStart.txt file.

    Requirements
    A properly formatted USB drive with an available partition for the NVRAM Save/Restore Utility installation.

    Installation
    Code:
    /usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/Xentrk/nvram-save-restore-utility/master/nsrum" -o "/jffs/scripts/nsrum" && sleep 5 && chmod 755 /jffs/scripts/nsrum && sh /jffs/scripts/nsrum
    Select option [1] Install NVRAM Save/Restore Utility to install the utility. You will be presented with a list of available partitions on the USB drive. Select the partition you want to install the utility in. A directory called nsru (the acronym for NVRAM Save/Restore Utility) will be created in the partition for the utility scripts and files (e.g. /mnt/ASUS/nsru). The installation program will also create a backup directory (e.g. /mnt/ASUS/nsru/backup) to keep the generated save/restore files separate from the utility scripts and files.

    To access the installation menu, type the command nsrum at the command prompt. To access the project directory, type the command nsru at the command prompt. These commands will not work after performing a factory reset since they require alias entries in /jffs/configs/profile.add, which will not exist after performing a factory reset. After a factory reset, you must navigate to the NVRAM Save/Restore Utility directory using the cd command (e.g. cd /mnt/AC88U/nsru).

    The scripts included in the NVRAM Save/Restore Utility are designed to be run from the command line.

    Project Development
    @john9527 is the original author of the NVRAM Save/Restore Utility. The last update made by john9527 was Version 26.2 released on 24-Sep-2018.

    @Martineau made numerous updates to the NVRAM Save/Restore Utility:
    • Version 30.1 code updates to nvram-restore.sh, nvram-restore.sh and nvram-save.sh made the utility compatible with the 384.13 Asuswrt-Merlin release.
    • Added functionality to nvram-restore.sh listing the restore files with the ability to delete a restore file or a range of restore files.
    • Add functionality to jffs-restore.sh listing the available jffs restore files.
    Xentrk contributed the hosting of the repository on GitHub, coding of the installation menu, code updates to make the code POSIX compliant, and updating the nvram variables in the nvram-merlin.ini file.

    FAQ
    Q1: Is the NVRAM Save/Restore Utility included in amtm?
    A1: Yes.

    Q2: Is there a menu to run the NVRAM Save/Restore Utility scripts?
    A2: No. The scripts were designed to be run from the command line.
     
    Last edited: Feb 15, 2020
    amplatfus, dextruder, Gar and 32 others like this.
  2. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    Reserved
     
  3. L&LD

    L&LD Part of the Furniture

    Joined:
    Dec 9, 2013
    Messages:
    11,561
    And now, the Asus router world is complete!

    Congratulations to all!

    @Xentrk, @john9527, @Martineau and to all the alpha/beta testers too for this latest version for this accomplishment that makes the @RMerlin 384.15_0 milestone even more remarkable!

    I will be testing this out as soon as I can.

    Thank you all again for this wonderful community. :)
     
    amplatfus, joegreat, Gar and 14 others like this.
  4. skeal

    skeal Part of the Furniture

    Joined:
    Apr 30, 2016
    Messages:
    3,836
    Location:
    Riderville, SK
    Nice to see this public. It's probably one of the most sought after utilities we have on this forum. It's back...! ;):)
     
  5. skeal

    skeal Part of the Furniture

    Joined:
    Apr 30, 2016
    Messages:
    3,836
    Location:
    Riderville, SK
    When using the migrate feature, I get a message saying that the file: dhcp_hostnames is empty or doesn't exist. It does however exist and is populated with information.

    EDIT: Actual output is:
    Skipping dhcp_hostnames (empty or does not exist)
     
  6. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    I may have to patch for HND vs. non-HND routers on that variable. There may be a few others I have to look at too.

    If you run nvram get dhcp_hostnames, does it return anything? It suspect it is empty. But there should be data in /jffs/nvram/dhcp_hostnames. Please confirm. Thanks!
     
  7. skeal

    skeal Part of the Furniture

    Joined:
    Apr 30, 2016
    Messages:
    3,836
    Location:
    Riderville, SK
    You're right no values to return from your above command nvram get dhcp_hostnames and yes dhcp_hostnames exists as a /jffs/nvram/ file and has contents.
     
  8. skeal

    skeal Part of the Furniture

    Joined:
    Apr 30, 2016
    Messages:
    3,836
    Location:
    Riderville, SK
    I have this stupid client list bug. That is why my dhcp_hostnames nvram value returns nothing. It's a hnd router. I'm RMA'ing it as we speak.
     
  9. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    In that case, you can add the @ in front of the dhcp_hostnames nvram variable so it is not picked up during a migration save. The jffs backup will contain the dhcp_hostnames and other nvram parms stored in /jffs/nvram. See the example below on how to exclude for a migration restore.

    HND users will need to exclude the dhcp_hostnames parm from being saved during a migration saved during a migration restore. This can be done by prefixing it with a @. This is only valid for individual settings and is not valid on the section header.

    Code:
    [System - Basic]
    @time_zone_dst
    time_zone
    time_zone_dstoff
     
    L&LD likes this.
  10. rgnldo

    rgnldo Very Senior Member

    Joined:
    Nov 12, 2018
    Messages:
    762
    Location:
    Brazil
    Thank you so much for this release. It made it much faster :)
     
    Kingp1n, Xentrk and L&LD like this.
  11. kernol

    kernol Senior Member

    Joined:
    Feb 24, 2018
    Messages:
    373
    Location:
    South Africa
    +1
    Installed and worked flawlessly on my RT-AC86U - including my small number of dhcp_hostnames which remain in /jffs/nvram/dhcp_hostnames as confirmed in post by @Xentrk above. :D
     
    Xentrk and L&LD like this.
  12. ^Tripper^

    ^Tripper^ Senior Member

    Joined:
    Aug 16, 2014
    Messages:
    202
    Location:
    Disneyland with the death penalty
    I sometimes wonder if there are any Asus engineers lurking around, fists in the air, cursing that they’ve been beaten to releasing a feature they’ve been working on for months, only to see it already figured out by you amazing folks.

    Excellent work all around. This place rocks!
     
  13. Diamond67

    Diamond67 Senior Member

    Joined:
    Jul 23, 2015
    Messages:
    212
    Instructions:
    Stupid question:

    I did format a 2 GB usb stick (NTFS) with my computer and named it "NVRAM_UTIL".

    And connected it to my router. But it is not listed (as "available partitions...") when I try to install the Utility (= choose [1] Install NVRAM Save/Restore Utility ).

    All other usb sticks (which contain entware etc.) are available however.

    I can see the usb stick from Merlin GUI, and from PuTTY I can see it with command
    Code:
    ls /mnt
    How can I get this "Properly formatted USB Drive with designated partition" available for me?
     
    Last edited: Feb 12, 2020
  14. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    The reference you quoted is a carry over from the original QuickStart guide. I will remove the reference to NTFS as the installer script doesn't recognize the NTFS format as a partition based on your feedback. The original NVRAM Save/Restore Utility had to be installed manually. I recommend using one of the current partitions on your USB. The installer will create the directories "nsru" and "nsru/backup" in the partition to keep the code and backup directory separate from the other utilities installed on the partition. Or, you can format a new stick to Linux EXT2, EXT3 or EXT4 using free utilities available in the internet such as EaseUS.
     
  15. Xentrk

    Xentrk Part of the Furniture

    Joined:
    Jul 21, 2016
    Messages:
    2,761
    Location:
    The Land of Smiles
    On pfSense, the settings are saved in XML format. I've never had a need to factory reset after an update. I wonder if Asus firmware will eventually migrate to XML format rather than using nvram variables.
     
  16. Diamond67

    Diamond67 Senior Member

    Joined:
    Jul 23, 2015
    Messages:
    212
    I formatted the stick to EXT2 with my Puppy Linux and after that everything worked nicely. I executed both Backup Mode and Migration Mode scripts successfully. :)
     
    Xentrk likes this.
  17. JohnD5000

    JohnD5000 Regular Contributor

    Joined:
    Nov 20, 2016
    Messages:
    160
    Is there a list of HND vs Non-HND routers so we can figure out whether or not we have one?
     
  18. Butterfly Bones

    Butterfly Bones Very Senior Member

    Joined:
    Apr 10, 2017
    Messages:
    1,285
    Location:
    USA
    HND - RT-AC86U and RT-AX88U
    non-HND - all others RMerlin currently supports
     
    Stevens243 and QuikSilver like this.
  19. JohnD5000

    JohnD5000 Regular Contributor

    Joined:
    Nov 20, 2016
    Messages:
    160
    Thanks, I have a RT-AC86U ansd some RT-AC68Us on my network. Looks like I have both. What does HND stand for?
     
  20. Butterfly Bones

    Butterfly Bones Very Senior Member

    Joined:
    Apr 10, 2017
    Messages:
    1,285
    Location:
    USA
    I cannot even get Google to reveal that one! :p

    Here is the best info I can get from the great Googly-Moogly.
    https://github.com/Entware/Entware-ng/issues/772
     
    Xentrk, Stevens243 and L&LD like this.