Bekijk de volledige versie : how to back up everything
I would like to now a recommended procedure for backing up the entire machine, in other words, the firmware AND all the settings.
The purpose of this exercise is to create an exact copy of the machine on new hardware for testing purposes.
- I know the contents of the flashfs can be saved via the web interface (flashfs management).
- Then there's the settings i altered in NVRAM, mainly vlan stuff, which can be saved using the web interface too (settings management).
- I've got packages on a usb stick, i'll just make a copy of that entire filesystem.
- Then i would also like to backup the current firmware, can that be done? if so, how ?
would u guys say that should cover it ?
newbiefan
13-10-2007, 10:43
An entire backup of firmware does not make any sense to me.
When needed, you can flash firmware anytime.
For all other files (configured) I use winscp. Winscp is easy to handle, free and allows you to restore/save any file very fast with the ease of a mouse click. And finally just enter a console and perform a flashfs save && flashfs commit && flashfs enable && reboot - thats it!
actually the part of the fs which can be altered by user is located here: /tmp/local
Issue
flashfs save and you'll obtain a file /tmp/flash.tar.gz which contains all the changes, settings etc stored in the built-in flash (remember the maximum size is 64kbytes). Save this file and be happy.
When you want to restore the configuration you just flash the firmware, put the file flash.tar.gz in /tmp , then issue
flashfs commit && flashfs enable && reboot and you have everything back.
To manipulate the content of nvram I see two possibilities. You can store output of
nvram show write a simple script to put the values from this list back line-by-line using
nvram set. Second you can save nvram image using:
cat /dev/mtd/3 > /tmp/nvram/nvram.bin with restoration following using
cat /tmp/nvram/nvram.bin > /dev/mtd/3 (I have to admit that the last command I didn't needed to test yet).
Finally, here is my script which is started daily by cron, which makes backup of important (IMHO) files
#! /bin/sh
PATH="/opt/local/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
x=10;
while [ `date +%Y` -eq 1970 ]
do
sleep 5m
x=$(($x-1))
[ $x -eq 0 ] && exit 1
done
TIMESTAMP=`date +%Y%m%d`
flashfs save
mkdir -p /tmp/nvram
cat /dev/mtd/3 > /tmp/nvram/nvram.bin
nvram show > /tmp/nvram/nvram.txt
cat /dev/mtd/4 > /tmp/flashfs.bin
tar cvfz /opt/tmp/save/fs/$TIMESTAMP.tar.gz /opt/etc /opt/local /tmp/nvram /tmp/flash.tar.gz /tmp/flashfs.bin /opt/tmp/amule/Temp/*.met
I usually make a complete tar-package from /opt (that's where my packages are ~600mb.. resulting in ~150mb tar)..
all my data is stored on /mnt..
The greatest thing is, that I can restore the tar package on the asus of a friend of mine.. (has 'almost' the same setup as me., and the post-boot files are the same)..
So all the work that's done to the packages can be 'directly' replicated to his machine..
HTH