Wednesday, March 6, 2013

Rpi Backup

My Rpi is working very well (as shown on previous post). My many years of Admin'ing UNIX systems is paying off.

I have spent several hours / days configuring the system, building a web page, and playing with use ideas. I do NOT want to lose any of my efforts due to a dumb mistake or system crash - so a backup is needed.

Several backup strategies are suggested in the web forums, the most often mentioned method is; shutting down the Rpi system, and cloning the SD card. Which I think is a good idea - but maybe only once in a while. The size of my 16GB SD card and system interruption precludes doing this very often.

Most of the Rpi system is easily re-built from the original image, and most (if not all) other system additions are obtained from online software depots.

After building (cloning) the original SD image, and like most Rpi users, I expanded the file system size to fill the rest of the SD card. And then executed the following:


sudo aptitude update
sudo adduser --system <my-desired-user-name>


And, of course, I had to install "fldigi" for a potential radio connection.


sudo aptitude fldigi



Now, . . . I really do not need a full backup, just the backup important stuff. A very clever backup command is "rsync", which I have used many times on very large systems. Rsync can be installed as:


sudo aptitude install rsync


With the following rsync command,  I can backup a few important directories to another remote linux system, in this case a system called "shilo", from the local (Rpi) system is called "magpi". The directories that I want to backup are: "etc", "boot", "home", "root", and "var/spool/cron".


(
  cd / &&
  rsync -avzR --delete etc boot home root var/spool/cron  shilo:/Backup/magpi/SnapShot01
)


The nice thing about "rsync" is that the backup files are easily accessed via "scp" or directly on the remote machine. Also, re-executing the same command, will only transfer the files that have been changed. See the rsync manual page.

--

No comments:

Post a Comment