After much procrastination I finally got around to setting up the backup for my Ubuntu box. As little research on the net would indicate, doing a backup for Linux boxes are fairly straight forward with tar and cron doing most of the heavy lifting. Doing a tar on the whole file system is the easiest way to get the job done. Something like the following is usually sufficient.
tar cvzf system.backup.tgz / --exclude=/backup --exclude=/proc
--exclude=/lost+found --exclude=/mnt --exclude=/sys
The exclude list can include other things one wants to exclude. In my case after I ran this the first time I realized that I had forgotten to account for the shared drives on my Windows boxes that I often have mounted via GVFS. So I had to do a minor tweak to the tar command as the following.
tar cvzf system.backup.tgz / --exclude=/backup --exclude=/proc
--exclude=/lost+found --exclude=/mnt --exclude=/sys
--exclude=/downloads --exclude='*/.gvfs'
Two other things I needed to do was to set up a backup for the mysql database running on the box and delete the image thumbnails that are cached by nautilus, and I did not realize how much space they end up taking over time.
The following took care of thumbnails that have not been accessed more than 7 days.
find /home/[your user name]/.thumbnails -type f
-atime +7 -exec rm {} \;
For mysql I decided to go with mysqldump instead of mysqlhotcopy. All by backup data are written to a mounted QNAP NAS drive folder.
So I ended up with a shell script that first flushed the thumbnails, created the mysql backup data files, and a tar file backup of the entire system. Of course I had to make sure all the data was written into time stamped folders. I also decided to preserve only the two previous backups besides the current one.
Once the script was ready, dropping it in /etc/cron.weekly did the job.
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=75c5f8e1-3add-45fd-8e60-9431b654733f)