Date: August 27, 2007
Author(s): Rob Williams
Backing up your computer is important. Don’t be the sucker who loses important files and has to deal with it afterwards! In this how-to, you will learn about using rsync and lftp, writing your own scripts and adding them to crontab and of course, backing up to your external storage, NAS and also a remote server running Linux.
Introduction, rsync Basics
Although I don’t like to admit it, I have screwed up many times since I first began using computers. My first big, “Oh shi!” was when I was about 8 years old, goofing around on our trusty 286 with monochrome monitor. DOS was a new world to me, and I quickly found out that format c: was NOT the proper command for deleting contents off a floppy disk. What a fun day that was…
Luckily, much has changed since then, but even in recent memory I can recall careless mistakes I’ve made, which have led to lost files. But, no longer. I made it a goal to keep perfect backups of my data so that I don’t suffer such a fate again, and I highly recommend everyone reading this article to do the same. It’s one of the worst feelings when you realize you lost a file that you cannot get back… so don’t let something like that happen to you.
Today’s article will be focusing on just that… backing up your files in Linux. This article will not be focusing on backing up your entire system, although I’m sure that you could do such a thing with some of the tips provided here. That’s up to you to test out if you are interested. Instead, we will be focusing on backing up your personal data, anything you feel you want to keep safe.
There are many different mediums that you can back up to, but we are going to take a look at the three most popular and go through the entire setup process of each: 1) Backing up to external storage; 2) Backing up to a Network-Attached-Storage (NAS) and 3) Backing up to a remote server running Linux. On this first page, we are going to delve into the wonderful tool that is rsync, and give examples for you to edit and test out for yourself.
“Why not rsync?” might be the better question. Essentially, rsync is a file synchronization application that will match the target with a source, with proper permissions retained. The beauty is that its usage is not simply limited to the PC you are on, but it can access remote servers via RSH or SSH.
As an example, let’s use the scenario that you want to back up your top secret documents folder to a thumb drive. When given the “OK”, rsync will copy all of the files to your thumb drive, making sure to retain the correct permissions while verifying that all of the files match. If you update a file and run rsync again, it will update the file to the storage you specify… simple as that. Though it’s not immediately user-friendly, given its command-line-based nature, once you gain basic knowledge of how it works, you will wonder how you went so long without using it.
The important thing to note is that there are numerous methods of backing up your files and system under Linux and that I am only touching the basics. This tutorial is based off of what I personally rely on, on a daily basis, and are also techniques that can be easily implemented into your own system.