Making backup painless

* If you don’t know who or what this is, check the Glossary page.

*** WARNING: This is post pretty geeky. ***

Last time, we talked about how important backup is at The Robotic Frog. Let me show you how we made it painless.

First, let me describe the new computer setup here at RFCC*. We added a machine…Chatterbox*…that is our new file server. We’ll say more about Chatterbox next time, but for now, understand that it’s the machine that we have our backup hard drives connected to. Untouchable*, Whitestar*, and Defiant* talk to Chatterbox to back up their files. Untouchable and Whitestar are desk machines that sit side-by-side in RoboFrog’s office. They are situated so that HE* can turn ninty degrees without moving HIS* desk chair and use either one. Defiant is a laptop that sees service everywhere on the LilyPad. Check out the Glossary page if you’re interested in more detail about the machines.

Yesterday, we showed you our backup script. The script is named rbak. It is stored in the directory /home/bvines/Myfiles and must be executable. It’s also backed up in /home/bvines/Myfiles/Restore. Untouchable, Whitestar, and Defiant get shut down at the end of each day. Before they go down, we want everything that was created that day to be backed up. These machines run Arch Linux. Arch has a file /etc/rc.local.shutdown. If we place the command /home/bvines/Myfiles/rbak in this file then rbak runs each time the machine is shut down.

{

If you’re running Ubuntu: 1) copy rbak to /etc/init.d 2) make a symbolic link to rbak in /etc/rc6.d. The name of the symbolic link is important.

sudo cp /home/bvines/Myfiles/rbak /etc/init.d
cd /etc/rc6.d
sudo ln -s /etc/init.d/rbak A01rbak

}

This assures that these machines are backed up every time we shut them down. It’s automatic. We don’t have to hope that HE will remember to run rbak.

Chatterbox is different. It stays on 24/7. On Linux systems there’s a utility called cron. It runs programs or scripts periodically: hourly, daily, weekly, monthly. We run rbak daily on Chatterbox. To make this happen, copy rbak to /etc/cron.daily. Any program or script saved in this directory gets run once each day by cron. Again, it’s automatic.

This is a simple scheme for keeping up with our backups. It automates the entire process. We had occasion to test this system today. That story next time, but here’s how we restore a system.

*** rsto ***

#!/bin/bash
echo “”
echo “…restore thunderbird from backup…”
rsync -azr –stats /media/Media/Now/Myfiles_chatterbox/Restore/thunderbird/ /home/bvines/.thunderbird
echo “”
echo “…restore Myfiles from backup…”
echo “”
rsync -arz –stats /media/Media/Now/Myfiles_chatterbox/ /home/bvines/Myfiles
echo “”
echo “…restore complete…”
echo “”

##########

This is the restore script for Chatterbox. As I said, we needed to use it this morning and it worked perfectly. We keep a directory in every Myfile folder called Restore. It has information that we use to restore a machine. We keep a copy of rsto there. To restore a machine all we have to do is copy rsto from our backup drive to our main user, directory, /home/bvines in our case, then execute rsto (./rsto). Obviously, rsto must be executable. That’s all there is to it. Painless.

Next time…HE’s loose again!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s