Are you backed up? Linux backups couldn't be simpler if you use the open-source utility Synbak.
One of the most common mistakes anyone can make is not having a quality backup of data available at their disposal. I know it only took me one instance of deleting something that I didn't have a copy of to implement some form of backup system. For home use, I back up my Linux laptop weekly onto an external USB disk and also nightly across the network onto a desktop system with a RAID 1 200G mirror using Synbak. This ensures I have more than one location to pull data from in case I get excited and delete something that I thought I didn't need access to again.
In a similar but more complex approach at the office, multiple tiers of backups are available to the IT department's fingertips. Data is not only copied to tape and taken offsite, but also synched to multiple backup servers, also located offsite. This ensures that we have a disaster plan in case the apocalypse comes to destroy our data. While some custom applications write directly to tape, the majority of the backups performed are using the rsnapshot utility, running rsync over SSH (Secure Shell). While rsnapshot works wonders for sophisticated backup strategies, it offers a bit of a learning curve to set up and understand.
Synbak's Simpler Approach
Although I definitely suggest you check out rsnapshot for backups, Synbak offers an easy-to-implement backup solution that's perfect for home and small-to-medium-sized business use. Synbak needs to run on a Linux server, but it can back up data from other sources. Backups can be completed across rsync over SSH, the rsync daemon, SMB, and Common Internet File Systems (CIFS). Synbak also has the ability to connect to LDAP, MySQL, and Oracle databases to pull backups. You can then write the backups to disks, tape devices, or CD-RW/DVD-RW devices on the Synbak server. Two choices are available for the style of backup you would like: total or incremental backups.I should take a moment to discuss connecting remotely to databases. While Synbak provides the ability to connect to LDAP, MySQL, and Oracle databases, Synbak doesn't assist you in setting up this remote access to the host. You will have to consult the appropriate database documentation on configuring access remotely.
The utility provides some very nice reporting features as well. Reports can be emailed to the appropriate administrators, and they can also be viewed across nicely formatted HTML pages. For the full feature list of the tool's ability, please visit the feature page.
Installing Synbak
Documentation is a bit lacking, but once you get it installed, the configuration files are pretty well documented. A few installation types are available, depending on what kind of Linux distribution you are running. The source code is available to install on any type of Linux server, or if you're running a Red Hat/Fedora variant, RPMs are available. Download the appropriate files from the downloads directory. Source RPMs are also available if you want to get involved with rebuilding your own.To install from the source, follow these steps:
# tar -xzvf synbak-1.0.11.tar.gz
# cd synbak-1.0.11
# ./configure
# make
# make install
To install from RPM, follow this step:
# rpm -ivh synbak-1.0.11-2.noarch.rpm
Setting Up a Backup
The first time you run synbak from the command line, it creates a hidden share in your root directory that contains the necessary configuration files. For demonstration purposes, I'm going to use rsync over SSH as the procedure for backing up a remote Linux host. The -s option is the name of the job or backup, and the -m option is the method of backup. I use the hostname of the machine being backed up as the job name.Other options for the backup method (-m) are as follows:
· -m rsync—Access remote machines over SSH with rsync protocol
· -m mysql—Connect to a host and dump all MySQL databases
· -m oracle—Connect to a host and dump all Oracle databases
· -m ldap—Connect to a host and dump all LDAP databases
Run the synbak command for the very first time.
# synbak -s hostname -m rsync
ERROR: '/root/.synbak/rsync' directory doesn't exist or it isn't accessible I just created it for you.
If this is a new backup system please remember to copy the '/root/.synbak/example.conf' config file in the '/root/.synbak/rsync' directory
example:
cp /root/.synbak/example.conf /root/.synbak/rsync/hostname.conf
Next, move into the directory that it just created and open up the example.conf file to see what options are available to you. You can then copy the file as the instructions on the command line mentioned.
# cd /root/.synbak
# cp /root/.synbak/example.conf /root/.synbak/rsync/hostname.conf
Just about every option in the configuration file has comments beside it explaining its meaning and use.
backup_source = /home /etc #Directories to backup
backup_destination = /backup/$system #Specify where to store
Follow along for every option that you want to set. If you don't want incremental backups (meaning you'll get one full backup and then each subsequent run grabs only the changed files), then set that option to no. This will keep x amount of full backups for the number you specify in the following parameter. If you prefer incrementals, change this option to read yes.
backup_incremental = no #Full backsup, not incremental
backup_erase_after = 5 #Keeps 5 full backups at a time
The next line specifies the user name and password used to connect to the remote client. This topic is beyond the scope of this article, but I would suggest setting up passwordless SSH keys across your host and server so that passwords are not kept in plain-text files. There are tons of resources for setting this up, but here's just one SSH key-generation guide I found on Google. This not only ensures that remote hosts can connect to one another, but also offers some security in doing so.
backup_remote_uri = ssh://root@host/ #With keys setup
If you want email reports, change the options to yes and make sure you change the email address to your own. You can change the options for standard output reporting as well. I suggest the following if you're going to report across email. This will suppress standard output on the command line and leave reporting to sending you an email. Your mileage may vary, depending on how you tackle logging with Linux.
report_stdout = no #Set to no once you have it running
report_stdout_on_errors = yes
report_email = yes
report_email_on_errors = yes
report_email_rcpt =
The very last option in the file is whether or not to create pretty HTML files in order for you to check on the status or keep a history of backups that have completed or failed. This requires a working installation of Apache on your Linux server. Specify the paths to the files with the following options.
report_html_destination = /var/www/html/admin/log/backup
report_html_uri = http://localhost/admin/log/backup
The last step before running Synbak is to create the necessary paths as you filled them out in the configuration above if you chose to allow HTML reporting.
Create the paths for the backup_destination and report_html_destination:
# mkdir -p /backup/hostname
# mkdir -p /var/www/html/admin/log/backup
Running Backups
If you have everything configured properly, as shown above, you can go ahead and run the backup from the command line to test it out.# synbak -s hostname -m rsync
If you have the standard output reporting turned off above, you'll receive no output. You can turn this on and off as you test out the backups. To verify that the backups are indeed there, change to the backup directory and take a look. You should also receive an email giving you the results of what just occurred. If you've created the HTML files, you can go to your URL, such as http://synbakserver/admin/log/backup/. If you drill down through the links, you'll eventually get something that looks similar to Figure 1.
Figure 1: Here's your Synbak report. (Click image to enlarge.)
Scheduling Backups
The very last step is to ensure that backups run nightly without having to manually execute the command at the shell. To accomplish this, you'll need to make an entry in the Linux crontab file. To view a sample, check at the top of your hostname.conf file. Otherwise, something simple like the following example will schedule a nightly run. Open up crontab and add the following lines. Notice the MAILTO line: Ensure the quotations are there as displayed. This makes sure that the errors are suppressed, since you already set up error reporting within Synbak.# crontab -e
MAILTO=""
00 2 * * * /usr/bin/synbak -s hostname -m rsync
Write and quit this file by typing :wq and hitting Enter. This will execute the command on the host every morning at 2:00 a.m.
Uncomplicated Backups
If you do a search on Google for "Linux backups," exactly 1,940,000 results are returned. It can be somewhat intimidating to set up and implement backups, especially in a Linux environment. While utilities such as rsnapshot, Bacula, and Amanda offer excellent enterprise-level backup solutions, they can sometimes be overkill for smaller applications. Synbak offers a simple approach to ensure your data is protected.I had the opportunity to chat via email with Synbak's author, Ugo Viti. Ugo gave me the news that a new version will be available soon and also passed along a pre-release of Version 1.0.12 to test out. If you have any questions or concerns, please feel free to email him directly at
LATEST COMMENTS
MC Press Online