ashar_oz contact
Chief author, Open Source enthusiast, Web Programmer, and UI/UX Designer.
Wednesday, July 21, 2010 at 13:33


Data is an important asset owned by company, data which is the raw of information require a necessary method how keep and preserve well, to reduce the impact of damage and data loss which possibility occur. Backup and restore procedure that a part of disaster recovery planning is one of the way that can be perform to reduce the impact of data disaster. From statement above we can conclude that  all of us need to ensure all important data of us or our company must be backup well. And now the answer is, how to design a reliable backup and restore system which can run on linux ?
To design or build backup and restore system we must have reliable tool to move data from source to destination via network, lucky we have rsync running in linux operating system. Rsync is such application which can move data (use incremental method) from one computer to another through ftp, scp, and ssh, rsync is small and multi perform application which can be use as server or client.  

Step 1
First time before you start build a system we must describe what system we want to build otherwords describe fungsional and non fungsional sytem requirement then design the layout of application.

Step 2
Step 2 we must prepare our system and install all required application, for this section for required application we can install ssh-server, mysql5.0-server, and rsync as main application. with no less important  don't forget to describe supporting factors such database design, working directory, and previllages user to run.

Step 3
Important part of backup and restore system is script to copy/move data form one computer to another, for this section i have provide some script write in bash language that found in internet then modified it then you can download by following this link. Maybe you can't use script given directly, you can modified that script and fit to your system.  I will give explanation to have clear illustration, you can open the script while read this.
  • This script is running by cron, work valid by parameter save in file (/var/www/LIBT/exec/. That file configuration contain of  backup parameter such us name of session, rsync parameter, source and destination mechines. this file writen by application interface (you can build by your self) which help user to descibe backup session they want to build.
  • This script work to manage/colaborate supported application like rsync, mv, cp, mysql, chmod, chown, etc.
  • Plot of backup procedure of this script is  -- [read configuration file] -- [check input parameter given] -- [decide local/remote backup] -- [perform backup/rotate backup] -- [write log/give feedback]-- .This script can due incremental backup so if you have running the same backup before, system will save previous data backup and make a new copy of data backup, this important procedure can be use to implemented restore point.


Step 4
Test the script you build, the only way to test the script is try to implemented backup betwen two computer. Rsync is wells work with SSH, so i suggest that you chose SSH as media backup. Before start to backup you must consider  both of computer is free to access one to another, use ssh-key to make it happend, here step to make ssh-key between two computers. 
  • First log in on A as user a and generate a pair of authentication keys. command : ssh-keygen -t rsa.
  • Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine) command : ssh b_user@ | mkdir -p .ssh. 
  • Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time, command : cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
  • Try to log on to computer B from computer A, if the machines not ask any password you have success implemented ssh-key and your system is ready to test
Step 5 
If all testing has complate, Verify data of backup you have got. if all data is identic (similar) to source data we assume that we have successfull reaserch and ready to the next step (restore). 

Step 6
Restore procedure is desperately needed backup information of previous procedure (backup), if you consider to add restore tool as additional feature of your system, you must write down all action, time execution, and all additional information needed to the database so you can use it then. Some infomation you have to record when doing backup is source and destination mechines (ip address), time of backup (to get restore point), path folder where you have save the data backup, user and password or ssh-key.

Step 7
If all step is clear and successfully tested, i think you have build a reliable backup and restore system under linux. please fell free to contact us if you get any problem.