Compression: gzip vs bzip2 vs 7-zip

Today I had a look at the different options to compress files (in this case for backup purposes) on a Ubuntu system. The most common tools to compress files are gzip and bzip2. They have both been around for a long time, are available on most systems by default and are nicely integrated with other utilities like GNU tar (using its -z and -j options).

7-zip and the algorithm it uses (LZMA) is not that common on UNIX-like operating systems. It is well-known as a free alternative for WinZip on Windows systems and was started back in 1998. For Ubuntu p7zip – a port of 7-zip to POSIX – is available in universe (sudo apt-get install p7zip).

My test file was a MySQL dump with a size of 163 MB that contains mostly text. I was interested in the compressed file size and in the time it takes to compress and uncompress the file.

Here are the results:

Compressor Size Ratio Compression Decompression
gzip 89 MB 54 % 0m 13s 0m 05s
bzip2 81 MB 49 % 1m 30s 0m 20s
7-zip 61 MB 37 % 1m 48s 0m 11s

For the test I ran all tools with their default settings, i.e. without providing any special options.

Gzip is still a great tool and provides good compression without consuming a lot of computation power. Bzip2 is much slower and only provides slightly better compression. 7-zip consumes a bit more cycles than bzip2 but results in far smaller compressed files. Speed for decompression is even better for 7-zip than for bzip2.

So if time is important (think of on-the-fly compression) gzip is the tool of choice. If you don’t care too much about processing speed and need very good compression have a look at 7-zip. The only advantage bzip2 has over 7-zip is that bzip2 is part of most default installations and is more common. Let’s hope this will change in the future, especially integration with GNU tar would be great.


Using Kernel-based Virtualization

Recently I stumbled upon KVM (for Kernel-based Virtual Machine) which allows you to leverage the virtualization features built into modern processors.

This blog entry got me started. I am running Ubuntu Gutsy Gibbon 7.10 on an AMD Athlon(tm) 64 X2 Dual Core Processor so I installed qemu and kvm, loaded the kernel module and created a disk image for my virtual machine:

sudo apt-get install qemu kvm
sudo modprobe kvm-amd
qemu-img create node1.img -f qcow2 6G

Next I added myself to the kvm group to access /dev/kvm. As an alternative you can temporarily loosen the permissions (sudo chmod 666 /dev/kvm) but don’t forget to fix that later on.
I grabbed the iso image of the server edition of Ubuntu 7.10 and was ready to boot the vm and start the installation:

kvm -m 750 -cdrom ubuntu-7.10-server-amd64.iso -boot d -std-vga node1.img

Wow! That was easy:

I installed Ubuntu just like on every other computer. Once the installation was done the automatic reboot failed as expected and I closed the qemu window and started it again (this time with only 500MB of RAM which is still plenty):

kvm -no-acpi -m 500 node1.img

I booted a fully running Ubuntu system – even networking automagically worked.

This looks like a great alternative to the bloated VMware server especially as it is extremly easy to just copy or move the virtual machines if you want to play with clustering for example.

Read more here and here (yes, you can also run Windows this way). Cool stuff!

Accessing Jira from Ruby

On Ubuntu I’ve installed ruby, the interactive Ruby shell irb and rubygems through apt-get and performed a gem update:

apt-get install ruby irb rubygems ruby1.8-dev
gem update --system

Gem is to Ruby what apt-get is to Ubuntu and Debian or CPAN to Perl: A package manager with support for dependencies providing and easy way to install extensions.

As with Java I prefer to us the native tools of the language to manage libraries and extensions so I only used apt-get to install the base and added the remaining dependencies through gem:

gem install rake
gem install soap4r

Rake is Ruby’s make or ant and allows to build applications from source. Soap4R is a soap library for Ruby.

Now it’s time to install Jira4R. I’ve used the latest version from their subversion repository:

cd /usr/local/src
svn co jira4r
cd jira4r
gem build jira4r.gemspec
gem install *.gem

Using Jira4R is quite simple:

require 'rubygems'
require 'jira4r/jira_tool'

jira =, "")
jira.login("soaptester", "soaptester")

issue =
issue.project = "DEMO"
issue.type = "1"
issue.summary = "Test from Ruby"
issue.assignee = "soaptester"


You can find more examples on the Jira4R page and in Jira’s SOAP API.

If you access your Jira instance through SSL you can add

jira.driver.options["protocol.http.ssl_config.verify_mode"] = nil

before the call to login so that Soap4R does not try to verify the SSL certificate. If you don’t you will encounter errors like

.../httpclient.rb:1039:in `connect': certificate verify failed (OpenSSL::SSL::SSLError)

Empty Windows in Swing Applications on Ubuntu 7.10

Using Java applications on Ubuntu 7.10 (gutsy) sometimes show empty windows. I’ve encountered this mainly with LDAP Browser/Editor and IDEA 7.0. It does not occur too often and mainly with small dialog windows. I guess Java 6 has some problems with Compiz which is enabled by default since gutsy.

The solution is to upgrade to Java 7 which is currently available as an early access version from the JDK 7 project at Sun.

This fixed my problems with LDAP Browser/Editor but IDEA complained with a “Java Version Mismatch” error. IDEA 7.0 officially requires Java 5 or Java 6, but also works with the EA of JDK 7. You can disable the check for the correct Java version by adding the following line to idea.vmoptions:


As eivindw wrote in the comments you may also be able to make IDEA work with Java 6 by setting the following environment variable:

export AWT_TOOLKIT="MToolkit"

MToolkit switches to the Motif implementation of AWT which was removed for Java 7. On my 64-bit version of Gutsy using MToolkit with Java 6 resulted in a core dump.


Ubuntu 7.10 on the IBM Thinkpad T43p

Today I’ve installed Ubuntu 7.10 (gutsy) on my IBM Thinkpad T43p.

I am using Ubuntu on the desktop for a few years now with Windows banned to a virtual machine. On the notebook I’ve stayed with Windows XP which worked fine. In the past using Linux on the notebook meant trouble with encrypted WLAN connections, missing support for hibernate and problems with notebook specific devices.

After booting the Ubuntu live CD the graphical installer was easily launched and ran without problems. The fresh system booted fine and I was a bit surprised when I logged in: It just works – out of the box:

  • Ubuntu recognized the internal WLAN adapter, provided a list of available wireless networks, asked for the WPA key and obtained the network config through DHCP
  • Ubuntu asked to install a few updates it discovered on its update site
  • the new 3D accelerated desktop (compiz) was enabled by default using the open source drivers for ATI cards
  • in Firefox scrolling using the right margin of the touchpad just worked
  • and finally: hibernating to disk and resuming did not cause any trouble.

I’ve kept the original Windows XP installation on a separate disk as I intended to restore it after my short trip to Ubuntu, but it seems I will keep Ubuntu and ban XP to a vmware instance.