华硕网络产品技术交流平台

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

查看: 5281|回复: 0

[图文] NVRAM and Factory Default Reset

[复制链接]

307

主题

1164

回帖

6341

积分

论坛元老

论坛最穷的没有之一

Rank: 8Rank: 8

积分
6341

RT-AC88URT-AC68UGT-AX11000RT-AX88URT-AC5300RT-AC86URT-AC66UGT-AC5300Blue CaveRT-AC87URT-N12+ PRO

QQ
发表于 2015-12-25 19:31:01 | 显示全部楼层 |阅读模式
A lot of questions related to nvram keep popping up on the forums, usually always the same coming back again and again. This post is an attempt to at least clear up a lot of recurring questions.


What is nvram?
NVRAM stands for Non-Volatile Random Access Memory. It's a small portion of the router's flash memory that's usually between 32 KB and 128 KB in size (depending on the router model), and which contains all the router settings. This includes both some low-level settings that are automatically managed by the router (such as power gain per antenna, GPIO addresses of hardware features, etc...), temporary storage, and user-configured settings.


Default settings - where do they come from?
The first time a router boots, it will start by copying various default settings from the bootloader (or CFE in the case of Broadcom's routers). Once it starts booting the firmware itself, another set of default settings are taken from the firmware, and written back to nvram. This is why in certain cases it's very important that you do a factory default reset (more on this below).


What happens if I run out of nvram space?
Best case scenario: your router simply stops storing any settings change you make. Worst case scenario: the nvram content gets corrupted, router crashes, and you are forced to do a factory default reset, and start all over from scratch to be able to once again boot the router.


Why do I sometime need to do a factory default reset?
In addition to those user-entered settings, there's all those system level settings I previously mentioned. Sometimes, the manufacturer will need to change some of those low-level settings, either to resolve an issue, or to adapt to a newer wireless driver that they started using.

If you fail to do a factory default reset, then your router will still have the old values, and it will keep using them. That can lead to performance issues (especially in changes related to the wireless driver), or flat out odd behaviour (if one of the settings no longer works the same way as before).


Can I just restore my saved settings after I do a factory default reset?
No. The idea behind a factory default reset is to have your router start using the NEW default values. If you restore your saved settings, you will overwrite those new values with the old ones, and you are back to square one.

This is similar to having a PC with a corrupted Windows installation. If you reformat, and immediately after you restore a Ghost/TrueImage/Clonezilla backup on top of the reformatted Windows, you are back to where you were before you did all that work.


Factory default reset: before, or after flashing?
Since the goal is to use the NEW default values that are included in the NEW firmware, the factory default reset must be done while the NEW firmware is already flashed. Doing so before flashing will leave you running the OLD default values.


How do I do a factory default reset?
Multiple ways to do so, which will depend on your particular situation.

If your router fails to boot due to corrupted/invalid nvram settings, then you will have to turn off the router, press the WPS button (on Asus routers), then turn on the router. Wait about 10 seconds, then release the WPS button.

If the router is booting correctly, then you can use any of the following:

  • While router is running, press the reset button for about 5 secs, then release it. Router will then reboot.
  • From the webui, on the same page where you can save/restore saved settings, there is a button to restore factory default values
  • Over SSH, you can run the "nvram erase" command.
  • Over SSH you can manually erase the nvram partition (do not use this method unless you know what you are doing! Erasing the wrong partition can permanently brick your router!) Run "mtd-erase nvram", followed by PHYSICALLY turning off then on the router. Do not use the reboot command.



Any way to ease the pain of reconfiguring after a factory default reset?
A few methods:

  • Note down the important settings, using screenshots, and then reconfigure the router using these screenshots as a reference.
  • Keep a text-based backup of all your settings, and manually restore the important settings over SSH/telnet.
  • Use a specialized tool such as [color=rgb(34, 34, 156) !important]John9527's tool, which is specifically designed to handle various scenarios.


How to I use get a text-based backup?
Connect to your router over SSH/telnet, and run the following:

Code:
nvram show | sort
If you have a USB disk plugged as /mnt/sda1/, then you can save the output to a text file:

Code:
nvram show | sort > /mnt/sda1/settings.txt

How do I restore a specific setting?
If you noted down a particular setting (or have a complete text dump of them), the syntax would look like this example:

Code:
nvram set dhcp_staticlist="what is saved in your text file output"... do all others nvram set here ...nvram commit

When do I need to do a factory default reset?
The first rule is to check the changelog of the firmware you are about to flash. If for a particular reason this specific firmware release requires one, it will be mentionned.

Also, if jumping more than one revision, check the changelog of past release. If going from 376.40 to 376.45, and 376.43 required a factory default reset, then you must also do so with the 376.45 flash.

As a general rule, if you are jumping more than 2-3 revisions, it's often safer to do a factory default reset. If you want to try out without doing a factory default reset, go ahead and try it. But at the first sign of problem, be prepared to do one.


What are those saved config files for if I can't reuse them?
Those are backups. They are still very useful for the following scenarios:

  • When trying to resolve an issue by making a lot of random changes, and you want to be able to revert back to your original setup
  • If a bug, corruption issue or a power surge caused your router to lose all of its configuration, you can restore it
  • Having 2 or more alternative configurations that you want to easily switch between (personally, almost all my routers have a _Development and _Production copy of my settings, based on whether the router is fronting my Internet connection, or sitting behind another router).


Last edited: Feb 16, 2015

注意:本文源自梅林原创(Merlin)

微信扫一扫,阅读更方便^_^

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

快速回复 返回列表 搜索 官方QQ群
×

秒后自动关闭

小黑屋|手机版|Archiver|华硕网络产品技术交流平台 ( 苏ICP备16010857号-1 )苏公网安备 32050502000499号

GMT+8, 2024-4-23 19:41 , Processed in 0.029566 second(s), 32 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表