Before reading further... Are you looking for great Linux hosting from a company that cares about GNU/Linux? Pick Dreamhost hosting, get a 10% bonus to the disk space (and support Free Software Magazine in the meantime!)

Backup your workstation with Backup Manager

Saving yourself one day at at time

Download the whole article as PDF

Write a full post in response to this!


Backing up is one of those tedious jobs that has to be done but is usually relegated to the end of the To Do list. Enter Backup Manager, which is a set of Bash and Perl scripts that alleviate the tediousness of performing backups. Taking away some of the complexity of backup tools and combining others, Backup Manager brings simplicity to backing up. Obtaining a higher level view of backups also allows easier management of archives including retention. What follows is a method of backing up a single workstation daily and managing those backups.

Conceptual View

The concept behind Backup Manager is elegant, backups or archives are stored in a repository. The repository is a sub-directory or preferably a dedicated partition to hold the archives. Archives are built using backup methods. There are several backup methods, each defined by configuration options known as keys. These keys are stored in one or more configuration files. Each configuration file can define its own repository, backup methods and other options. Multiple instances of Backup Manager can be run in parallel, each with its own configuration file, although the same configuration file cannot run twice at the same time. Since Backup Manager is a command line tool it is simple to schedule archiving with a Bash script and cron.

Since Backup Manager is a command line tool it is simple to schedule archiving with a Bash script and cron

Figure 1: Conceptual View of Backup Manager
Figure 1: Conceptual View of Backup Manager

There are multiple types of backup methods used by Backup Manager. The most common are referred to as tarball methods, archives created with the tar command. The tar command, initially named for Tape ARchival, creates archives that do not necessarily reside on tape and are often stored on disk or other removable media. These tarballs can be compressed with several different compression types: zip, gzip, dar or bz2. To save disk space tarballs can also use a method to create full and incremental backups. With incremental backups, Backup Manager keeps track of files that have changed and only archives changed files, thus saving storage space. Other methods include the ability to archive MySQL databases, subversion repositories and customizable generic methods.

Storing of archives on the host system is not a preferred strategy of disaster recovery. There are a series of methods that allow remote storage of archives to other servers or removable media, i.e. CD/DVD. Upload methods consist of ftp, ssh, rsync and use of Amazon Simple Storage Service (Amazon S3). Each of these methods, with the exception of the burning method, requires a destination server with additional services and configuration. The destination servers will accept the uploading of archives, which is beyond the scope of this article. The burning method, currently the only export method, transfers archives from the repository to writable CD or DVD media via the cdrecord utility.

Installation and configuration

The example system is Kubuntu Edgy which uses version 0.7.2 of Backup Manager. Version 8.0 is promised to be available soon, so check the Backup Manager web site for updates. Since Backup Manager is a command line tool, installation and use will be performed from the command line. Installation is done with the apt-get command. Since there are a few things that need to be done as root and typing sudo for every command gets tiresome, becoming root will save some keystrokes.

$ sudo su -
Password:
# apt-get install backup-manager backup-manager-doc

For non-Ubuntu or -Debian based systems, check your distributions repositories for Backup Manager packages or install from source. The source tarball includes simple instructions in the included INSTALL file. The installation places several scripts in /usr/share/backup-manager, installs the configuration file /etc/backup-manager.conf, installs the man pages, the main executable script saved as /usr/sbin/backup-manager, a cron script /etc/cron.daily/backup-manager is setup and some documentation placed in /usr/share/doc/backup-manager.

Since Backup Manager is a command line tool, installation and use will be performed from the command line

The default configuration file is well laid out and documented, though reading the User Guide gives a better understanding of the keys and their values. Several changes to the keys in the default configuration file are made to configure daily backups and setting up the burn method. Using a favorite text editor (for example vi or nano), the following keys are changed. The BM_TARBALL_BLACKLIST key value lists sub-directories or files that will be excluded from the archive. Since I have ripped some music CD’s I have excluded the ogg files from being backed up using a Bash style wildcard. Directories and Bash style wildcards are appended to the key value and delimited with spaces. The key for the number of days an archive is kept is BM_ARCHIVE_TTL or archive time to live. The default value is ‘5’, five days, change the value to ‘7’ for full daily backups.

BM_TARBALL_BLACKLIST="/var/archives *.ogg"
BM_ARCHIVE_TTL="7"

The next set of keys relate to the burning method of exporting archives to CD/DVD media. The BM_BURNING_METHOD value is set according to the media that is to be burned to. In this case, CDR media is being used. Other options include DVD, CDRW and DVD-RW. The device that is being used is set with the BM_BURNING_DEVICE key, which is the device name found in the /dev directory. The final value is the size of the media that is being used, with the CDR media the values are normally 650, 700 or 800. In this example 700MB media is being used.

BM_BURNING_METHOD="CDR"
BM_BURNING_DEVICE="/dev/cdrw"
BM_BURNING_MAXSIZE="700"

Testing the backup

Command line options allow specific methods that are part of the configuration file to run independently. In the modified configuration file two methods are configured: the tarball method and the burn method. By using command line options one or the other method can be performed. Remaining as root user the --no-burn command line option is used to only create the archives in /var/archives. If /var/archives doesn’t exist it will be created after the first run.

 
# backup-manager --no-burn 
Don't miss out on the other pages!
12next ›last »

Write a full post in response to this!

Similar articles

0

Do you like this post?
Vote for it!

Copyright information

This article is made available under the "Attribution-NonCommercial" Creative Commons License 3.0 available from http://creativecommons.org/licenses/by-nc/3.0/.

Biography

Ken Leyba: Ken has been working in the IT field since the early 80's, first as a hardware tech whose oscilloscope was always by his side, and currently as a system administrator. Supporting both Windows and Linux, Windows keeps him consistently busy while Linux keeps his job fun.

savoyant's picture

" Since there are a few

Submitted by savoyant (not verified) on Wed, 2007-05-23 16:22.

Vote!
0

" Since there are a few things that need to be done as root and typing sudo for every command gets tiresome, becoming root will save some keystrokes."

Why not use "sudo -i" instead :) Anyways great article.

Have you checked out BackupPC as well?

dubski's picture

Restore

Submitted by dubski on Tue, 2007-06-19 10:06.

Vote!
0

How about a little section on how to restore from backup? I'm asuming that I will use the incremental backup strategy. Is it as easy to restore files either from online servers or DVD? This is one thing that I have not figured out how to do easily with Linux.

Cheers,
Pete