OpenWrt Forum Archive

Topic: HELP: complete firmware backup with software & configuration files

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am looking to install a new openwrt firmware on my netgear wndr3800. I already have an older version of openwrt installed. I would like to do a complete firmware backup of my current setup, all applications and configuration files intact. I have read a couple of conflicting ways to do this.

one way is from
http://dangerzau.blogspot.com/2008/04/o … -just.html

dd if=/dev/mtd/1 of=/tmp/firmware.trx

another way is from
http://www.youtube.com/watch?v=fPjv1385mjA
dd if=/dev/mtd0 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd1 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd2 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd3 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd4 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd5 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin
dd if=/dev/mtd6 of=/tmp/openwrt_sysbackup`date +%d%b%Y`.bin


"I would like a working way to backup my entire system to a flashable rom/firmware including all installed software packages & configuration files"
this is so I can install a newer version of openwrt with a newer kernel so I may install additional software packages that require a newer kernel.

I have also read a couple of other guides to do this, that only require some of the /dev/mtd partitions to be stacked in the bin file.

Questions:
1: Do I need to backup all mtd partitions?

2: if no, which ones will I need to backup to get a flashable firmware image with all software packages and configurations intact?

I know how to backup/restore my configuration and other needed files, I know how to get around directories, obtain, and flash a rom.

I am currently running:
OpenWrt Attitude Adjustment r33556 on a Netgear wndr3800 V2 (I think) with ar71xx

I would like to upgrade to this vesion:
http://downloads.openwrt.org/attitude_a … pgrade.bin

My current setup is important so if I run into problems I need to be able to easily reflash back to my current state as to avoid down time.

(Last edited by dreadycarpenter on 11 Aug 2013, 21:35)

"cat /proc/mtd" generates this

root@openwrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00050000 00010000 "u-boot"
mtd1: 00020000 00010000 "u-boot-env"
mtd2: 00100000 00010000 "kernel"
mtd3: 00e80000 00010000 "rootfs"
mtd4: 00c90000 00010000 "rootfs_data"
mtd5: 00010000 00010000 "art"
mtd6: 00f80000 00010000 "firmware"

any help appreciated. cheers

Why are you trying to update to an rc version of AA?
The final version is in http://downloads.openwrt.org/attitude_a … x/generic/

You should not worry too much about returning to the old version. I have been doing a community build for WNDR3700/3800 for almost three years, and Openwrt is very stable and works well with WNDR3700/3800. You might check: https://forum.openwrt.org/viewtopic.php?id=28392

1)
Regarding your backup plans, they sound a bit complicated. I suggest a bit simpler backup plan. You are using the squashfs version that makes it rather simple.

There are two parts that you are interested of:
Flashed read-only "ROM": The firmware itself that you have downloaded and flashed. If you have the original package on your PC, you can always reflash it.
Flash r/w "RAM": All installed packages, all modified system files and all settings. With squashfs version, all modifications will get written in to /overlay directory. I contains a mirror of your file system tree with only those files that have been modified. It is usually seamlessy shown on top of the ROM files, so that you don't really notice it.

For backup purposes, it would be enough to copy all files from /overlay to a safe place. If you then need to recover, just reflash the needed firmware, boot into the router and copy those files back to /overlay and reboot. (Yeah, you need to maybe install a few packages to get the USB stick supported, but still rather easy).

2)
Alternative version for the upgrade path might be to backup all config settings and generate a list of installed add-on packages. Copy that list to your backup location. Then flash the new version, install packages using a script based on that list and restore the config settings.  You might read this thread: https://forum.openwrt.org/viewtopic.php … 78#p194478

3)
Regarding the MTD sections, u-boot, u-boot-env and art are read-only and Openwrt does not touch them.

(Last edited by hnyman on 12 Aug 2013, 07:11)

so none of my questions are answered,
are you saying I cannot do a complete firmware backup with all apps and data?

Questions:
1: Do I need to backup all mtd partitions?
2: if no, which ones will I need to backup to get a flashable firmware image with all software packages and configurations intact?

dreadycarpenter wrote:

so none of my questions are answered,
are you saying I cannot do a complete firmware backup with all apps and data?

Questions:
1: Do I need to backup all mtd partitions?
2: if no, which ones will I need to backup to get a flashable firmware image with all software packages and configurations intact?

No, I did not say that. I gave you the approach that I see as the easiest way to do the full backup, i.e. copy the contents of /overlay. I see no point in saving and then re-flashing also all the empty sectors, which you apparently insist doing. I a typical WNDR3800/WNDR3700v2 installation quite much of the flash is usually unused (unless you have crammed it full of packages).

To make you feel better, I try to answer your questions regarding the mtd approach...
1: No.
2: Like I already said in my previous answer, naturally you do not need the read-only parts, as those have never been modified by Openwrt. So you can forget about u-boot* and art.
Regarding the other mtd sections:
If you check the kernel log, you will notice that the mtd section adresses overlap eachother quite much. As far as I understand, you only need "firmware" 0x000000070000-0x000000ff0000, as both kernel and rootfs are covered by it. The r/w part of the live file system, rootfs_data is splitted away from rootfs itself, but is also included in that address space.

[    2.900000] 0x000000000000-0x000000050000 : "u-boot"
[    2.900000] 0x000000050000-0x000000070000 : "u-boot-env"
[    2.910000] 0x000000070000-0x000000170000 : "kernel"
[    2.920000] 0x000000170000-0x000000ff0000 : "rootfs"
[    2.920000] mtd: partition "rootfs" set to be root filesystem
[    2.930000] mtd: partition "rootfs_data" created automatically, ofs=0x5e0000, len=0xa10000
[    2.940000] 0x0000005e0000-0x000000ff0000 : "rootfs_data"
[    2.940000] 0x000000ff0000-0x000001000000 : "art"
[    2.950000] 0x000000070000-0x000000ff0000 : "firmware"

(Last edited by hnyman on 12 Aug 2013, 15:21)

I guess topic starter is looking for a way to easily restore the router, doesn't matter which version is installed.
so when he decide to roll-back he would flash latest build, attach usb stick and overwrite all necessary partitions with all data he has at the moment, then reboot and it's done

The discussion might have continued from here.