Rsync for ipaq backup and restore
These are instructions for using rsync to backup and restore the pods
software on an ipaq.
Both commands are run on the ipaq as root.
To restore the software to the ipaq use the following command:
rsync -avx --delete -e ssh root@base:/home/ipaq/saves/dir/ /
Example:
rsync -avx --delete -e ssh root@192.168.10.21:/home/ipaq/saves/20060114/ /
To backup the ipaq to the base station use the following command:
rsync -avx --delete -e ssh / root@base:/home/ipaq/saves/dir
where dir is the remote subdirectory to save as, for
example the date in the form YYYYMMDD.type. So for March 24, 2004,
it would be 20020124.type. For camera pods I use 20020124.camera, for
evalboard pods 20020124.evalboard, and for the one-wire pods
20020124.onewire. A directory without a .type extension works for
all pods.
Things to do (on the base station) before restoring:
- cd to the backups directory. Sample command:
cd /home/ipaq/saves/20060114/
- change these three filees to reflect the desired IP address:
etc/pcmcia/network.opts, home/weather/bin/sweep_weather.sh, and
home/camera/bin/sweep_camera.sh. Sample command:
vi etc/pcmcia/network.opts home/weather/bin/sweep_weather.sh home/camera/bin/sweep_camera.sh
- verify that the last line of etc/inittab is indeed uncommented.
Sample command:
tail -2 etc/inittab
- verify that root/modes/stayup exists.
Sample command:
ls -l root/modes/stayup
Things to do (on the IPAQ) after restoring:
- verify that the IP address in /etc/pcmcia/network.opts is correct.
Sample command:
grep IPADDR /etc/pcmcia/network.opts
-
shutdown -r now
- if you can now get in via ssh, go ahead and comment out the last
line in /etc/inittab.
After commenting out that line, it is probably best to reboot.
Sample command:
vi /etc/inittab
shutdown -r now
- touch one of the two files,
/root/modes/weather or /root/modes/camera .
Sample commands (only execute ONE of these two):
touch /root/modes/weather
touch /root/modes/camera
- after testing, and assuming this IPAQ is meant to sleep, remove
/root/modes/stayup.
Sample command:
rm /root/modes/stayup
Things to do (on the IPAQ) before and after backing up:
- uncomment the last line of /etc/inittab, so it is easy to recover
the ipaq if it goes down.
Sample command:
vi /etc/inittab
- make sure the modes directory only contains a single file,
named "stayup".
Sample command:
ls -l /root/modes/
- after backing up, perform all the steps in the list above
("after restoring the IPAQ") starting with step 3 ("comment out the last line in /etc/inittab")
Note: you may skip some of the above shutdowns if you know what
you are doing. Otherwise they are required.
The following is the old list, might be useful for reference
- after uploading, be sure to set the address appropriately in
/etc/pcmcia/network.opts and either /home/weather/bin/sweep_weather.sh
or /home/camera/bin/sweep_camera.sh
- Also, check and, if necessary, change the base station in
/root/bin/gender.sh and the sweep file above (note, the base
station is now defined in /etc/hosts, unless you have an old pod --
check /etc/hosts first).
- It is usually a good idea to uncomment the last line of
/etc/inittab before rsyncing, and to comment it back before turning
the pod loose. The last line turns on getty on the serial port, and
will prevent either the camera or weather software from working, but
allows easier access into the ipaq should anything go wrong. It
might be a good idea to turn off the camera/weather software
when uncommenting the last line of /etc/inittab.
It is probably a good idea to reboot at least once before editing
inittab to turn off getty on the serial port.
- It is also a good idea to shut off uschedule before rsyncing (in
either direction), and turn it back on afterwards. Uschedule is turned
off by running /root/uscheduleRM, and back on by running (in sequence)
/root/uscheduleCMD (ignore the error messages) and
/root/uscheduleSET_TIME. If uschedule was not turned off before
rsyincing (i.e. is not turned off on the base station), you may need
to turn it off before turning it back on.