02
Sat, Nov
2 New Articles

TechTip: Easily Back Up Linux Hosts with Synbak

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 = This email address is being protected from spambots. You need JavaScript enabled to view it.

 

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.

 

synbak_web_report--122107.png

 

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 This email address is being protected from spambots. You need JavaScript enabled to view it..
Max Hetrick

Max Hetrick is an Information Systems Assistant for an electric utility. He has experience with installation and maintenance of both Windows and Linux operating systems from the PC to server levels. Max is also an open-source software advocate. He welcomes all comments and can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: