Backing up your Raspberry Pi code using rsync06 Jul 2013
This is how I develop code on my Raspberry Pi:
ssh into the Pi from my Macbook Pro from 2 Terminals, and use emacs on one to edit the code, while I run the code from the other. This way I don't need to use the annoyingly slow X-server or VNC solutions to display UI from the PI for editing.
Installing emacs on the Pi is exceedingly simple, by the way:
sudo apt-get install emacs
There are other editors, but really nothing beats emacs or vi when it comes to editing code on Linux, and I highly recommend that you spend some time learning one of these editors.
Since I develop code on the Pi directly, I need a backup plan, and the plan is rsync.
rsync is a Unix utility that can synchronyze your files between directories and other machines (via ssh).
rsync is very powerful, and not to be meddled with unless you are paying attention. If you are mucking around it with it, (a) back up your test files and (b) use the -n or "dry run" flag so it only tells you what will be done and not actually do it, till you are satisfied.
Here is my script to back up my code directory (recursively) from the Raspberry Pi on to my Macbook:
Here is a typical run:
sent 502 bytes received 24631 bytes 4569.64 bytes/sec </code>
Backing up RPi #1...
receiving file list ... done
total size is 23024 speedup is 0.92
sent 502 bytes received 24631 bytes 4569.64 bytes/sec