Working with lzma tarballs

      No Comments on Working with lzma tarballs

The Lempel-Ziv-Markov chain algorithm is a (at least in the Linux-world) relatively new compression method. It features a very high compression ratio that is generally much higher than bzip21. Unfortunately there a quite a few different implementations. So creating and extracting lzma archives on different Linux distrubutions will vary.

While the latest Fedora comes with GNU tar 1.22, which has a built-in flag for lzma compression, CentOS still uses GNU tar 1.15.1; So you will have to pipe your tarball manually to the lzma binary. Here is an example:

On Fedora 11, creating an lzma compressed tarball is rather simple:

tar cfv backup.tar.lzma a/dir --lzma

Just like decompressing it

tar xfv backup.tar.lzma --lzma

You may want to skip the verbose flag v in a script.

On CentOS 5.3 you first have to pull lzma from a 3rd party repository like RPMFusion

yum install lzma

before you can create you archive with:

tar cv a/dir | lzma -c -z > backup.tar.lzma

For decompression, just pipe the hole file into lzma -d and un-tar the output:

cat backup.tar.lzma | lzma -d | tar xv

Again: You may want to skip the verbose flag v in a script.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.