nvram show equivalent to GUI backup settings

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
rawd
DD-WRT User


Joined: 06 Jan 2014
Posts: 173

PostPosted: Sun May 26, 2019 21:25    Post subject: nvram show equivalent to GUI backup settings Reply with quote
Is executing 'nvram show' to a file the equivalent to making a configuration backup file from the GUI?

I'd like to set up a job to export settings from the terminal to backup configuration settings that I can use to restore my settings if they ever get corrupted/lost.

I compared the .bin file the GUI exports and it looks very similar to 'nvram show' but I want to be sure.

_________________
R7800 AP WDS - OpenWrt SNAPSHOT r16941
R7800 Client WDS - OpenWrt SNAPSHOT r16941
R7000 CB - r46949 std
PiHole v5.3.1 - dnscrypt-proxy 2.0.45 - RPi 3 B+
Synology DS220+ - DSM 7 RC
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1405

PostPosted: Sun May 26, 2019 22:38    Post subject: Reply with quote
you could execute:

nvram backup {filename}
nvram restore {filename}

that is all the gui does
rawd
DD-WRT User


Joined: 06 Jan 2014
Posts: 173

PostPosted: Sun May 26, 2019 22:47    Post subject: Reply with quote
great thanks
_________________
R7800 AP WDS - OpenWrt SNAPSHOT r16941
R7800 Client WDS - OpenWrt SNAPSHOT r16941
R7000 CB - r46949 std
PiHole v5.3.1 - dnscrypt-proxy 2.0.45 - RPi 3 B+
Synology DS220+ - DSM 7 RC
rawd
DD-WRT User


Joined: 06 Jan 2014
Posts: 173

PostPosted: Mon May 27, 2019 18:46    Post subject: Reply with quote
Wildlion wrote:
you could execute:

nvram backup {filename}
nvram restore {filename}

that is all the gui does


This worked perfect thanks. It exports the same binary the GUI does as you said.

_________________
R7800 AP WDS - OpenWrt SNAPSHOT r16941
R7800 Client WDS - OpenWrt SNAPSHOT r16941
R7000 CB - r46949 std
PiHole v5.3.1 - dnscrypt-proxy 2.0.45 - RPi 3 B+
Synology DS220+ - DSM 7 RC
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6388
Location: UK, London, just across the river..

PostPosted: Tue May 28, 2019 12:56    Post subject: Reply with quote
Wildlion wrote:
you could execute:

nvram backup {filename}
nvram restore {filename}

that is all the gui does


tried this on 1043 v2 with no avail either its not working or im not aware what it does and how to spell it

nvram backup {1043v2backup} - not working
nvram backup {filename} - not working
nvram backup 1043v2 - not working...

how it's suppose to work?? It was not asking where to save file at all, is the file saved somewhere else, already checked cd/tmp ...nothing there

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,AP Isolation,Ad-Block,Firewall
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear R7800 --DD-WRT 55363 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55363 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
rawd
DD-WRT User


Joined: 06 Jan 2014
Posts: 173

PostPosted: Tue May 28, 2019 17:34    Post subject: Reply with quote
Alozaros wrote:
Wildlion wrote:
you could execute:

nvram backup {filename}
nvram restore {filename}

that is all the gui does


tried this on 1043 v2 with no avail either its not working or im not aware what it does and how to spell it

nvram backup {1043v2backup} - not working
nvram backup {filename} - not working
nvram backup 1043v2 - not working...

how it's suppose to work?? It was not asking where to save file at all, is the file saved somewhere else, already checked cd/tmp ...nothing there


This is what worked for me on my r7800 Kong build in my sig which i set in a nightly cron job.

nvram backup /jffs/DS216J/nvram_backup/nvrambak.`date "+%F"`.bin

_________________
R7800 AP WDS - OpenWrt SNAPSHOT r16941
R7800 Client WDS - OpenWrt SNAPSHOT r16941
R7000 CB - r46949 std
PiHole v5.3.1 - dnscrypt-proxy 2.0.45 - RPi 3 B+
Synology DS220+ - DSM 7 RC
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1405

PostPosted: Wed May 29, 2019 0:37    Post subject: Reply with quote
rawd is correct

here are a couple of examples:

Code:

root@ddwrt:~# nvram backup ./nvrambak.bin
root@ddwrt:~# ls
nvrambak.bin
root@ddwrt:~# rm -f nvrambak.bin
root@ddwrt:~# nvram backup nvramback.bin
root@ddwrt:~# ls
nvramback.bin
root@ddwrt:~# rm -f nvramback.bin
root@ddwrt:~# ls
root@ddwrt:~# pwd
/tmp/root


usage from the program:

Code:

root@ddwrt:~# nvram
usage: nvram [get name] [set name=value] [unset name] [show] [backup filename] [restore filename]


hopefully there is nothing wrong with your version... but I have used this on atheros and broadcom routers
LightMoon
DD-WRT User


Joined: 09 Sep 2012
Posts: 64

PostPosted: Sun Sep 12, 2021 4:58    Post subject: Reply with quote
Thanks, may I know how we can add the reversion number to the file name?
something similar to this - nvrambak_r47381_DD-WRT-C2_Netgear R7000.bin

_________________
Netgear R7000
(Latest SVN revision)
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6388
Location: UK, London, just across the river..

PostPosted: Mon Sep 13, 2021 6:57    Post subject: Reply with quote
save nvram backup via CLI
nvram backup /opt/1043v2.bin
restore nvram back up via CLI
nvram restore /opt/1043v2.bin

replace 1043v2 with any name you want...must have .bin at the end

replace /opt with any location you need...

do notice...name is not needed to be that long anyway...i use something like 1043v2-47381.bin

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,AP Isolation,Ad-Block,Firewall
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear R7800 --DD-WRT 55363 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55363 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
IONK
DD-WRT Guru


Joined: 19 Aug 2011
Posts: 947

PostPosted: Mon Sep 13, 2021 10:47    Post subject: Reply with quote
LightMoon wrote:
Thanks, may I know how we can add the reversion number to the file name?
something similar to this - nvrambak_r47381_DD-WRT-C2_Netgear R7000.bin
maybe something similar to this:
Code:
buildno=$(nvram get os_version | tr -d '[A-Z][a-z]')

boardraw=$(nvram get DD_BOARD)

board=$(echo $boardraw | tr '[A-Z ]' '[a-z-]')

nvram backup "nvrambak_${buildno}_${board}.bin"

(credits to easyddup - A simple upgrade/downgrade utility by yoyoma2)

_________________
▫ RSS feed for DD-WRT releases (2024): https://rsseverything.com/feed/7d36ab68-7733-46c3-bd8a-9c54c5cef08c.xml
easyddup - A simple upgrade/downgrade utility by yoyoma2 --- as featured in 📌 Reference Links, stickies retired back to forum (Moderator's Pick 🌟)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2899
Location: Germany

PostPosted: Mon Sep 13, 2021 11:57    Post subject: Reply with quote
Code:
root@DD-WRT:~# echo "nvrambak_r$(nvram get os_version)_DD-WRT_$(nvram get DD_BOARD).bin"
nvrambak_r47381_DD-WRT_Netgear R7800.bin


Code:
root@DD-WRT:/tmp# nvram backup "nvrambak_r$(nvram get os_version)_DD-WRT_$(nvram get DD_BOARD).bin"

root@DD-WRT:/tmp# ls -la nvram*
-rw-r--r--    1 root     root         35906 Sep 13 14:14 nvrambak_r47381_DD-WRT_Netgear R7800.bin



something like this ?
at least the backups on my R7800 look like this

or

Code:
root@DD-WRT:/tmp# echo "nvrambak_r$(nvram get os_version)_$(nvram get router_name)_$(nvram get DD_BOARD).bin"
nvrambak_r47381_DD-WRT_Netgear R7800.bin



Code:
root@DD-WRT:/tmp# nvram backup "nvrambak_r$(nvram get os_version)_$(nvram get router_name)_$(nvram get DD_BOARD).bin"



or for continuous automatic backups


Code:
root@DD-WRT:~# echo "nvrambak_r$(nvram get os_version)_$(nvram get router_name)_$(nvram get DD_BOARD)_$(date +%F).bin"
nvrambak_r47381_DD-WRT_Netgear R7800_2021-09-13.bin


Code:
root@DD-WRT:/tmp# nvram backup "nvrambak_r$(nvram get os_version)_$(nvram get router_name)_$(nvram get DD_BOARD)_$(date +%F).bin"
LightMoon
DD-WRT User


Joined: 09 Sep 2012
Posts: 64

PostPosted: Sun Sep 19, 2021 3:20    Post subject: Reply with quote
Great guys!
This could be another example of uploading the file to a TFTP server.

Code:
#!/bin/sh
###############################
#   Auto Backup configuration
###############################
version=$(nvram get os_version)
nvram backup /tmp/nvrambak_r"$version"_`date "+%F"`.bin
sleep 2
cd /tmp/
tftp -p 192.168.10.25 -l nvrambak_r"$version"_`date "+%F"`.bin
sleep 2
rm -f /tmp/nvrambak_r"$version"_`date "+%F"`.bin

_________________
Netgear R7000
(Latest SVN revision)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum