dd-wrt backup

Settings of such equipment is typically stored in nonvolatile memory. The devices can be found in the /proc/mtd

root@router:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "cfe"
mtd1: 003b0000 00010000 "linux"
#root file system
mtd2: 001db400 00010000 "rootfs"
mtd3: 00010000 00002000 "nvram"
#free partition (I keep it extra initialization scripts)
mtd4: 000f0000 00010000 "ddwrt"

Now, where do a full dump of interest to us section, and save somewhere on your computer.

root@router:~# dd if=/dev/mtdblock/3 of=/tmp/config.dd
128+0 records in
128+0 records out
#store on your computer
yurial@note:~$ scp root@ config.dd

To restore the settings to produce the inverse operation, and reboot.

#copy the settings from your PC to your device
yurial@note:~$ scp config.dd root@
#copy the settings from the dump
root@router:~# dd if=/tmp/config.dd of=/dev/mtdblock/3
#ps  before rebooting, disconnect usb-connected devices
root@router:~# reboot -f

In general, this way you can make a backup, not only for firmware dd-wrt, and not only on dir-320. Such a method suitable, for example, to backup iphone, or geeksphone.

PS: on my dir-320, under my own firmware before restarting I would do a sync, to make sure that all data were recorded. However, under dd-wrt I, this led to the crash.