Friday, February 4, 2011

Easy Linux backups

We would all like to think that, since we are using Linux, we will never really need a backup of our data. Now, let's look at this realistically. Even if your OS is 100% rock solid, with nary a nanosecond of downtime, that hardware running that OS can not possibly give 100% forever. Add to that the irresistible urge to upgrade hardware and you have the serious makings for the need to back up.
When you need to back up where do you turn? Of course you could slap together a good ol' fashion Bash script using rsync, ssh, tar, and a few other Linux tools. But for those who haven't the slightest idea how to cobble together their own Bash scripts, what is there to use to back up all of that precious data? Those of you who don't want to “roll your own” or those just looking for something easy to use, you're in luck... thanks to Lucky Backup! Lucky Backup is a very user-friendly backup tool that will have you backing up remotely or locally in no time. Once you've seen Lucky Backup in action you will never think Linux backups are difficult again.

Features

Of all the backup utilities I have used I have to say Lucky Backup is the easiest. It has a user-friendly interface that will make any user happy, and has the following features:
  • Create full backups.
  • Create snapshot backups.
  • Sync data directories.
  • Data checks to ensure nothing is erased.
  • Simple and advanced options.
  • Include/Exclude files.
  • Local or remote backups.
  • Scheduled backups.
  • Backup simulation.
  • Logging.
  • Command line option.
  • Profiles.

Installation

Installing Lucky Backup is simple. All you need to do is open up your Add/Remove Software utility, search for “luckybackup” (no quotes), select Lucky Backup for installation, and click Apply to install. Once installed you will find the tool in Applications > Accessories on GNOME. It might vary on other desktops.

Using Lucky Backup


When you open Lucky Backup the main window (see Figure 1) has pretty much everything you need to create and run a backup. Let's take a look at the process for creating a scheduled local backup.
Let's assume you are only going to need one profile for backup. You could, of course, create multiple profiles which would allow you to have multiple backup sets that could be run at different times (making Lucky Backup fairly flexible). But for the sake of simplicity, let's stick with a single profile.
The first step is to click the Add button which will open up the Task Properties window (see Figure 2). In this window you will need fill out a few pieces of information. As you can see you can only add one directory
per task. If you need multiple sources for this profile you simply create a task for each source.
Obviously you will not want your Source and Destination to be located on the same drive. For a local backup you will want to have either a second drive or an external drive attached. This drive will be your Destination for your tasks. You will also want to pay close attention to the Type of backup you are creating. You can do a full backup (copy all files/sub-folders from the source to the destination) or a synchronized backup (make sure source and destination are the same).
If you want to do any file/folder exclusion make sure you click on the Advanced button. In the Advanced section you can setup excludes, remote options, command options, and extra executables. Before you click the OK button it is always wise to click the Validate button to ensure your backup settings are good to go.

Once you have all of your tasks created you will want to set up the scheduled aspect of the backup. To do this click Profile > Schedule and then click the Add button in the new window (see Figure 3).
When the Schedule window opens click the Add button which will open up the scheduler. From here you can choose a Profile to schedule and then set the interval in which to back up. After you set the time for the backup click OK and the schedule is set...but not complete. After you set the schedule up you then need to click the crontIT! button which will then automatically create a cron job for the backup job.
Multiple backups
Let's say you have multiple directories you want to back up. You might even want different directories to back up in different way, to different locations, or to be run at different times or intervals. For this you will want to create multiple tasks. You could easily create a task for such backups as:
  • Documents
  • Music
  • Pictures
  • Videos
You get the idea. You can have as many tasks as you want. You can even create specific profiles and then create different tasks for each profile. Very flexible.

Remote backups

ou can do remote backups with Lucky Backup as well. Attended remote backups are actually quite easy to do. It is only when you want to do scheduled remote backups that you run into any difficulty. Let's take a look at how to do a single instance of a remote backup first. To do this you would create your backup as you normally would, but you must click on the Advanced button. From the Advanced properties click the Remote tab and begin to fill out the information necessary (see Figure 4).
To do an attended remote backup you will only need to fill out the following:
  • Destination (you need to make sure this directory exists on the remote machine).
  • User (this user must exist on the remote machine).
  • Host (this IP address or host name of the remote machine).
You will also need to select the ssh checkbox. After you complete that information click the Validate button to make sure everything is correct. If it checks out click Okay and you are then ready to run the backup.
There is one thing you will find when running a Lucky Backup remote backup. You will want to start Lucky Backup from the command line so you will be able to enter your ssh password (for the remote host). To start Lucky Backup from the command line open up a terminal window and issue the command luckybackup. Now when you hit the start button on Lucky Backup you will see your console window prompting for your ssh password. Enter the password and hit the Enter key to continue on with your backup.
If you want to schedule a remote backup you will have to set secure shell up to do password-less authentication. This is not necessarily the most secure process. If, however, you want to set this up just follow these steps:
On the local machine issue the command:
ssh-keygen -t dsa
This command will generate public keys that you can then copy to your remote machine. During the key generation do not enter a password, just hit enter when prompted. After the keys are generated copy them to the server with the command:
ssh-copy-id -i .ssh/id_dsa.pub username@destination
Where username is the user you will log into the remote server with and destination is the IP address of the server. To test this go back to the local machine and attempt to ssh into the server. You should automatically be logged into the remote machine. You can now set up scheduled, remote backups.

Running a backup

In order to manually run a backup (such as a remote backup) select the task you want to run and then click the Start button. You can optionally check the “simulator” check box to simulate the backup to make sure it will run properly. That's all you need to do! Let your backup run to completion and you're finished.