Backing up the easy way
Posted by notKlaatu , 07 May 2008 · 53 views
Rsync.It's a small but effective, and really easy program that comes on every *nix system.The best back up plan is:1. simple2. quick3. painlessTo make it simple, get ONE big cheap USB harddrive (USB so it will be cheaper) and back up all your stuff to it.To make it quick, keep the harddrive close at hand, so that you can plug it in and let it do its thing.To make it painless, establish a cron job that will automate the rsync backup. If not cron, then at least a shell script so all you have to do is type in ./backup and watch it do its thing.How to do all this?Buy the harddrive: buy.com or tigerdirect.com or newegg.com or whatever.Keep it close at hand.How to use rsync:rsync -av /home/yourname /mnt/backupdriveThis copies everything in your home folder to the backupdrive. It's that easy. Obviously it'll be fairly slow the first time you do this because EVERYTHING is getting copied. From then on, only the new stuff will be copied.Make it a cron job:The most straight-forward way of doing this is to simply open /etc/crontab in a text editor. Let's say vim...[codebox]# vim /etc/crontab[/codebox]and add this kind of text:[codebox]0 0 * * 0 username rsync -av /home/yourname /mnt/backupdrive[/codebox]...which is telling the Computor to run that rsync command as a user (hence, username in the 6th column) every Sunday at midnight regardless of what month it happens to be.The way a crontab entry works is easy.Minute (0-59) | Hour (0-23) | Day of Month (1-31) | Month (1-12) | Day of Week (0-6 with 0 being Sunday) | username | command to run<EOF...sort of...>That's probably all one needs to know.....except that lately Linux distros are using a middle step in accomplishing this and just fill their default crontab with commands to run cron.hourlycron.dailycron.weeklycron.monthlyWhat's all that? Have a look in /etc and you'll see directories called cron.daily and so on; and inside these there may or may not be scripts with actions to be run daily or weekly or whatever. So what you can also do, if you want to play nice with the distro creators (and why not? they were smart enough to make an entire distro that you use daily, so they must know something, right?) then you'll create a shell script, make it executable and place it in the appropriate cron.* directory.It doesn't have to be a complex shell script. It can just be as simple as:[codebox]#!/bin/bashrsync -av /home/yourname /mnt/backupdrive[/codebox]And that's it. Now make sure your computer is on every Sunday night at midnight, and that your backup drive is plugged in and mounted, and you should be good to go.