Skip to content
Biz & IT

Painless backups using rdiff-backup

Linux.Ars returns with an exploration of how to performing painless backups …

Ryan Paul – | 0
Story text

Introduction

Linux.Ars is back, with the first installment of the new year! This edition of Linux.Ars includes some hints about how to use Ubuntu for data recovery operations on Linux-based network appliances written by Martin Colello and introduction to painless backups with rdiff-backup written by Stuart Ellis. In addition to the usual fare, I have also written up some brief summaries of recent development news from the KDE and GNOME communities.

Linux.Ars is all about you, so don’t be afraid to get involved! Want to do a section for a future edition? Have a suggestion for a topic that you want us to write about? I would love some feedback. We want your comments, complaints, suggestions, requests, free hardware, death threats, or disparaging remarks about my assorted deficiencies. Send me an e-mail or instant message, or post a comment in the discussion thread!

Developers Corner

KDE establishes Technical Working Group

In an attempt to mitigate some of the organizational problems that tend to hamper large open source projects, KDE developers at aKademy 2005 in Malaga decided to establish a Technical Working Group. The seven future participants of the Technical Working Group will be elected from within KDE e.V., the nonrofit association that handles KDE’s legal and financial issues. The first set of elected Technical Working Group Members will serve for six months, and if the group is found to be effective, new elections will occur on an annual basis.

Inspired by the Marketing Working Group, which was established in November of last year, the Technical Working Group will be in charge of managing the official release schedule, moderating technical decisions, and interacting with KDE representatives. Technical Working Group decisions will be documented, and subjected to rigorous community oversight. The Group will utilize the kde-core-devel mailing list to conduct discussions and involve other developers and community members in the decision making process.

The release schedule is currently managed by SUSE employee Stephan Kulow, who strongly supports the creation of the Technical Working Group. Kulow feels that having to discuss release scheduling issues with the entire base of kde-core-devel subscribers slows things down. The following is a paraphrased version of Kulow’s statements excerpted from notes taken by Jonathan Riddell during the aKademy Working Groups Discussion:

We not only decided that we want working groups but also that we want technical guidance from the e.V. One of these working groups could be a technical working group. What he would like to have as the current release coordinator is to spread his responsibilities to that working group, so if he can’t make up his mind on something that’s affecting a release he can ask a smaller group then the whole 200 subscribers to kde-core-devel. He would like smaller groups, not sure what size, about 7, 8, 9. Zack shouts out 7 is good. Stephan: doesn’t have to be private. When he asks something on the kde-core-devel list many people ignore, some follow the arguments and say they agree, then there’s one who disagrees. The process does work but it’s not efficient and people who disagree have a bad feeling. He would like a council he can go to with questions.

This is really a very good idea, and I think that it will definitely improve communication and organizational transparency within the KDE community. If you are interested in learning more, you might want to take a look at the Technical Working Group Charter.

Gnome developments are afoot

Development on GTK 2.10 and Project Ridley are moving along nicely. A lot of work has gone into optimization lately, with Pango and the Filechooser getting a lot of love along with the new g_slice allocator which is now in CVS. The new g_slice allocator is already being used in some interesting contexts, including this nifty experiment, which makes it possible for a GtkTreeView to include three million rows.

GTK developers are currently working on integrating libglade functionality into GTK itself, and replacing the current GNOME Canvas widget with one that uses Cairo for rendering. Another important development is the inclusion of support for theme color alteration. At long last, GNOME users may be able to change the colors used by GTK themes that leverage the feature. A lot of work is also currently being done on the GNOME printing dialog.

The GNOME 2.13.4 development release, which includes some bug fixes, is now available for testing. The 2.13.5 feature freeze ocurred on January 16, and GARNOME 2.13.5 has already been released. Although not specifically related to GNOME development, the release of Beagle 0.2.0 certainly makes me happy. The new interface is teh spiffy.

The new Gaim 2 beta has everybody talking

The second Gaim 2 beta has been released and I have spent quite a bit of time playing with it. The new status system was not designed for people that like a small window and a minimalistic interface. If you don’t like the buddy list window to display buddy icons, you will probably not like the new interface changes. The size and position of the components make it relatively clear that it was designed for use with the verbose display settings.

The D-Bus support is coming along nicely. I have been experimenting with it in python, and it facilitates a lot of really neat external scripting. Unfortunately, the Gaim dbus API still feels like a bunch of wrapped C functions, so you get a lot of stuff like GaimBuddyGetAlias(buddyptr) rather than buddyptr.alias, etc. Aside from the lack of OO friendliness, the D-Bus bindings are really very useful, and I’ve already managed to do a bunch of great stuff with it. I’ll hopefully get around to writing an article or a tutorial about it sometime in the next month or so.

I’m still trying to figure out how to access buddy list data, but I have managed to do just about everything else I want to do with it, particularly intercepting messages for custom logging, and providing custom notifications of buddy sign-ins, etc. If anybody has any hints about how to iterate over the buddy list to extract strings and other relevant information, I would appreciate some insight.

The beta also includes some subtle improvements to tab handling that will probably be appreciated by many, but the developers still haven’t gotten around to making it so that the tabs can be hidden when only one conversation is active (you know, like the way firefox does it).

This version also has a different interface for connection information. It no longer shows progress bars indicating connection progress of each protocol, instead it just says “connecting” in the status box. When you lose your connection it displays an extra button with notification right above the status box. If your buddy list window width isn’t wastefully huge, you won’t be able to see what those buttons say.

There are also some nasty bugs still that you want to watch out for if you plan to actually use the beta. If you have a meta-contact that contains multiple buddies and even one of them is not signed in, the whole meta-contact will not appear when offline buddies are hidden. Can anybody else out there confirm this bug?

I compiled from source on my Athlon64 X2 system with 2GB of RAM. I enabled spell checking, perl scripting support, dbus, and several other things. I tried to enable mono, but for some reason ./configure didn’t want to do that. I assume that means that either my distribution doesn’t have the right version of the mono devlopment libs, or mono support isn’t complete enough yet to be functional.

My honest opinion is that the new interface needs a lot of work. It solves many of the problems that the interface had before, but it solves them in a way that is strange at best, and abysmally stupid at worst. What is needed is an alternative slim interface for people that just want quick access to their buddy list without all the other cruft. They removed a ton of configuration options, but I think that a lot of what is no longer configurable in the preferences dialog can be made configurable with plug-ins. That isn’t necessarily a bad philosophy because it keeps things nice and modular, but it will make the program a little bit painful to use until people get around to making the plug-ins that will make it bearable.

Keep in mind that I am talking about a beta release. As usual, I have no doubt that the skilled Gaim developers will resolve these issues before the official release. I am thinking about writing an article about how to leverage the D-Bus bindings in either Ruby or Python (probably Python, since the Ruby D-Bus bindings aren’t compiling in Breezy at the moment). I want to know how much interest there is in such an article. I would probably write it as a general introduction to D-Bus. If you would like to see an article on the subject, please leave a comment and let me know. If there is enough interest I’ll see what I can do.

Cool App of the Week

Backups without fuss: rdiff-backup

Backup is a pain. Yet these days many of us actually have access to relatively large quantities of storage on multiple systems, all connected together by the Internet. The combination of cheap computers, cheaper hard drives, and the magic of TCP/IP ought to mean that keeping backups of our vital files should be no problem at all.

Perhaps the main issue is finding a piece of software that lets us copy our files and then retrieve previous versions in a really convenient way. For organizations with large quantities of data and many users, a combination of tape and revision control systems may be the most convenient way of meeting all of their requirements. For personal use, something simple and undemanding may be in order.

How rdiff-backup works

The rdiff-backup program is a command-line utility with a simple syntax, that makes backup copies of one or more directories to a target directory. To that extent, it is just straightforward: type the command, and it does the job. Embed a command within a script for extra facilities, and add the script to the scheduled tasks to run automatic backups. Target directories may be on any writable device, and may be safely copied.

rdiff-backup elegantly supports networked backups by using SSH to communicate with another copy of rdiff-backup on another system. This enables you to backup and restore from a remote directory without having to deal with a separate service. SSH provides secure authentication and encrypted communications without any further work. The data transfer itself is automatically compressed, again using a built-in feature of SSH.

Another touch of class is the way that rdiff-backup holds your backups. The files that make up the most recent backup set are stored completely unchanged. Previous versions of the files are retained in zipped increment files. These increment files just hold the differences between the versions of the files in the most recent backup set, and the version of the files in previous backup sets. This enables rdiff-backup to provide many versions of a file, while using far less storage space than multiple full copies would require.

Preparing for rdiff-backup

Both the source and target systems need three things:

  • Python 2.2 or higher
  • SSH
  • A copy of rdiff-backup

SSH client and server software are readily available for all UNIX-like systems, and installed by default on many of the most popular systems. Similarly, Python is a standard part of many operating systems. Fedora, Red Hat Enterprise, and OS X include both by default. Debian and Ubuntu don’t include the SSH server by default, so you may need to install the ssh-server package via apt-get if you have not already done so.

Packages for rdiff-backup are available from the default Fedora, Debian, and Ubuntu repositories. Use your preferred package manager to install the package rdiff-backup. The Fink project provides rdiff-backup packages for Mac OS X.

For those on other systems, the best option may be to use the .tar.gz file from the rdiff-backup project website.

There is no configuration file to edit: rdiff-backup works out of the box.

Backing up Files

To backup a home directory, the command is:

$ rdiff-backup /home/me me@another-system.elsewhere.com::/home/me/backup

In this example, the source is a local home directory (/home/me). The backup location is just a directory on another system somewhere on the Internet. If the remote account (me@another-system.elsewhere.com) requires a password to access, rather than an SSH key, the password prompt appears as normal.

For all backup operations, the syntax follows a standard format:

$ rdiff-backup <local source directories> <user>@<remote system>::<remote backup directory>

If the specified remote directory doesn’t exist, then rdiff-backup creates it automatically. For safety, rdiff-backup only creates the last directory in the remote directory path, to ensure that you don’t end up with a whole new directory structure if your fingers slip.

The rdiff-backup utility may backup any files that you have access to. According to the FAQ, rdiff-backup is quite happy to handle 36GB sets of files, although the backups may take a few minutes if you have large sets of data. As always, if you have databases you should use a dedicated backup application to make offline copies of the data, and archive those rather than trying to backup the live storage files.

Since rdiff-backup uses SSH, there isn’t a lot to be said about security. The connection is automatically encrypted, and login uses either the password for the remote account, or an SSH keypair (if you have set this up).

You can also use a local directory as a backup store, of course. To backup to a directory on the same system, simply specify the source and the target:

$ rdiff-backup /home/me /anotherdirectory/backup

In all cases, the contents of the backup directory is identical to the source directories, with the addition of an rdiff-backup-data/ directory that stores the increment files.

Recovering Files

To recover the latest version of a file, you may simply copy it from the backup directory. Recovering previous versions requires rdiff-backup to use an increment file from one of your backup sets.

To get a list of all of the backup sets in an rdiff-backup directory, use the -l option:

$ rdiff-backup -l me@another-system.elsewhere.com::/anotherdirectory/backup

Which produces a list like this:

Found 2 increments:
    increments.2005-11-07T22:30:25Z.dir   Mon Nov  7 22:30:25 2005
    increments.2005-11-15T22:44:20Z.dir   Tue Nov 15 22:44:20 2005
Current mirror: Sat Nov 19 20:43:47 2005

The latest backup was on November 19, but we also have backups from the 7th and 11th of the month.

To restore a file or directory, specify the backup set, the path of the item in the backup directory, and the path for the recovered version. The command below restores one file from the November 11 backup set:

$ rdiff-backup -r 11-05-2005 me@another-system.elsewhere.com::/anotherdirectory/backup/me/myimportantfile.txt 
   /home/me/myimportantfile-recovered.txt

To restore a complete directory, the command is very similar:

$ rdiff-backup -r 11-05-2005 me@another-system.elsewhere.com::/anotherdirectory/backup/me/importantdirectory/
   /home/me/importantdirectory-from-11052005/

That’s all there is to it. When using tools like rdiff-backup, users should keep in mind that extended attributes and ACL data may be lost if the user/group entries on the client and server aren’t the same or if the server doesn’t support the feature.

Point and Click

If you have been wondering about a graphical interface for all this, Dave Arter’s GNOME utility pyBackPack is worth a look.

pyBackPack uses rdiff-backup to backup to directories and remote systems, in addition to the default CD backups. Developed as a project of the Google Summer of Code, pyBackPack is young, but essentially feature complete.

The site provides packages for Fedora and Ubuntu. To run pyBackPack, you will need to install the package gnome-python2-nautilus-cd-burner, as well as rdiff-backup itself.

Tools, Tips, and Tweaks

Linksys network appliance data recovery, starring Ubuntu

Recently my boss presented me with a small challenge. Handing me a hard drive he explained that the network appliance he uses at home as a file server had crashed and would not boot up. The hard drive he gave me was one of two mirrored drives that was inside the appliance. “Is there anything you can do with this?” he asked. He explained that he had spoken with Linksys and the OS of the device was Linux. After hearing this I felt confident and responded “Almost definitely.”

My first step was to put the hard drive into a Linux box I had at my desk, running Fedora Core 3. When I tried to mount the filesystem I got a complaint that XFS was not supported. At least I now knew which filesystem it was! My first idea at this point was to enable XFS support on my Fedora box. It turned out the recommended way to do this was to download a linux kernel with XFS support built in and enable it before compiling. Since this would have taken quite a while, I decided to go another route.

Ubuntu to the rescue!

I thought I’d look at some specs for live CDs and the first one that popped into my head was Ubuntu, due to a recent installation I had done and was impressed with. On Ubuntu’s website it stated clearly that XFS was a supported filesystem on the live CD So a half-hour download and a CD burn later I had my Ubuntu Live CD in hand.

Upon bootup Ubuntu tries to enable networking via dhcp. My box was on a subnet that did not have a dhcp server so the network connection was not able to configure itself correctly. After correcting my network settings and upping the nic I was on the network properly.

At this point I used the sudo su - command to get a root session. I created a directory called /restore. I issued the command mount /dev/hdb1 /restore, and presto! There the data was, perfectly readable. Awesome, I thought. Now how to get this data to my boss?

Under the System/Administration menu on the main desktop I found an entry for Shared Folders. Here I used the GUI to enter the directory to share, and then tried to map a drive from my Windows box to the new SMB share. The drive mapped successfully but I could not see any files…

It turned out, of course, to be a permissions issue. After issuing chmod -R 777 /restore, the files were available immediately on my Windows box. At this point I went to my boss’s laptop and mounted the new share drive, for which he was of course appreciative.

This is the kind of service provided by data recovery specialists and would be quite expensive.

Remember, if you have access to Linux, there’s a great chance you have access to every tool you need!

/dev/random

  • O’Reilley’s Linux DevCenter features an interview with Project Looking Glass developer Hideya Kawahara.
  • Trolltech has announced the release of QT 4.1.
  • Linux users are concerned about government web sites that don’t support alternative operating systems.
  • A software developer blogs about command line document manipulation with the AbiCommand plug-in for Abiword. I tried it out and noticed some significant stability problems. Anybody else have any luck with it?
  • Linux Journal has an interesting article about embedding Python in C programs.
  • The NetBSD folks announced the release of NetBSD 3.0.
  • Linux 2.6.15 has been released.
  • Make your own open source stuffed penguin.
  • Newsforge covers open source Optical Character Recognition software.
  • The next X.Org developers conference starts on February 8th in Santa Clara. If any of you plan to go, and you want to write about the experience for Linux.Ars, let me know.
  • KDE developers announced a new project that relates to hardware and networking, but as usual, the publicly available information is more fluff than content. Anybody have links to developer blogs with real information about the Solid project?
  • Fast User Switching panel applet is starting to look nifty, it looks like it might be included in GNOME 2.13.4.
  • GNU is almost ready to release Gnash, a complete open source Flash player for Linux. Maybe now I’ll be able to play Flash movies in my 64-bit Firefox build.
  • The latest edition of the Beagle newsletter includes details about recent Beagle improvements, like the pyBeagle Python bindings and libbeagle C bindings.
  • Linux.com has an introduction to building a home media center with Linux with this extremely sexy MSI rig. Unfortunately, the author leaves out important details, like whether or not the remote control is LIRC compatible. Does anybody happen to know?
  • Andrew Morton explains why he doesn’t use GIT to manage the -mm Linux kernel tree.
  • Aaron Seigo provides some insight into some of the new features slated for inclusion in KDE 4.
  • Gnome Journal has a nifty tutorial about building new GTK widgets that can leverage Cairo rendering.
Photo of Ryan Paul
Ryan Paul Ars Editor Emeritus
Ryan is an Ars editor emeritus in the field of open source, and and still contributes regularly. He manages developer relations at Montage Studio.
0 Comments

Comments are closed.