Automate Ubuntu Backups with Cron and TAR

Using Daily Cronjobs and TAR to Backup Data on a Ubuntu Desktop

Being relatively new to the world of Linux, I am often overwhelmed by the functionality that is built into the Linux operating systems that was previously unavailable to me under the Windows platform. This was the case when
 I discovered two powerful built-in pieces of my Ubuntu 7.10 Desktop software: cron and TAR. Cron is a daemon that runs in UNIX and Linux systems that automates tasks. A fresh install of Ubuntu has many cron scripts already installed. Cron will run hourly, daily and monthly, and you can see these scripts by looking in the /etc/cron.hourly, /etc/cron.daily, and /etc/cron.monthly directories. Each file under those directories is an executable script that gets called by the cron daemon either hourly, daily or monthly. So imagine any task that you can write a script for in Linux can now be executed automatically. Isn't that the main goal of computers, to automate mundane human tasks?

TAR is the next internal program that I have come to love. TAR is a tape backup archive file program. It basically allows you to pull in tons of data, and make a copy of that data into one file for backup purposes. In Windows, in order to create a stable backup, I'd have to use something proprietary. Which means purchasing software. The built-in Windows backup software leads a lot to be desired, but generally, all Windows backup software will to the same thing. It will compress the files into a proprietary file format. Now, if I did have a disaster, I'd have to find or build an emergency recovery disk just to restore the files back into the computer. As I've referred in previous articles, the main reason to switching my home PCs to Linux was ease of recovery and re-installation over Windows. In the Linux world, I can use TAR to extract all my backed up files, and the file permissions and ownership (something critical in the Linux world) are preserved. So my goal was to use cron daily scripts and TAR to automate a daily backup routine that would ensure my data is preserved. Once I had that data into one file, the last step would be to figure out how to automate an ftp upload of my data to a separate PC for offline storage.