Squash Your Read-Only Data to Save Disk Space

April 25, 2007

SquashFS is a compressed read-only file system for Linux. Most live-cd distributions compress the data on their CDs with (you guessed) SquashFS.

It used to be necessary to patch and recompile the kernel to get SquashFS to work, but in modern distributions it seems to work out of the box – at least in Ubuntu it does. All you have to do is install the squashfs-tools package.

sudo aptitude install squashfs-tools

I’ll give an example of how to create and mount a SquashFS image. I will compress two directories: kdelibs-apidocs (the API for KDE 3.5, about 280MB) and jdk-1_5_0-doc (the API for Java SDK 5.0, about 225MB). To create the image, use the command mksquashfs <list of directories> <image name>

mksquashfs kdelibs-apidocs/ jdk-1_5_0-doc/ doc.squashfs

Pure magic! 505MB of data compressed into a reasonable-sized 71MB image!

But that’s not all. Now you can mount the image and browse the directories in it at a speed almost as high as if they wouldn’t be compressed.

sudo mount -o loop -t squashfs doc.squashfs /mnt/doc

And unmount it with

sudo umount /mnt/doc

You can put these into scripts and have them on your desktop, only one click away!

Here’s a tip for the more adventurous folk: You can have LZMA compression with SquashFS, but that requires some dirty kernel patching. LZMA is one of the best compression algorithms out there, as you may know from the 7-Zip file archiver. The default SquashFS uses mere gzip compression.

Read the rest of this entry »


Some Randomness…

April 17, 2007
  • Firefox has reached nearly 25% of the market share in Europe. The leading countries are Slovenia and Finland, with 44.5% and 41.3% respectively. Firefox usage in Romania is at about 25.7% and there is no data about Moldova.
    (more…)
  • A Romanian KDE Forum has been launched recently.
    (dot article)

Have a nice evening everybody!


The Door

April 15, 2007

Don’t ask me what all this is about, because I’m not sure myself.

Read the rest of this entry »


Enjoy The Silence…

April 15, 2007

Many audio books are split into tiny pieces of 1-2MB (under 10 minutes). This has bothered me for quite some time, as my DAP has a nasty habit of not playing the last few seconds of files, thus making it impossible to hear the last words. Today I decided to do something about it. I expected powerful tools like mplayer/mencoder to have an option for this kind of thing, but wasn’t able to find one. So I went for the hard way: I created a file with 0.5 seconds of silence (with Audacity), and manually appended it to each and every of the 100+ files (with qwavjoin, which is part of the quelcom package). I made a bash script for automating it (and converting to OGG right away). Note that to merge two WAV files they need to be the exact same format (i.e. the same sampling rate and number of channels). If the stereo, 22050Hz “silence file” I used doesn’t work, you’ll need to create your own. You can see this script and some other stuff in the Magic section.

Good luck and happy listening ;)


Feisty +1 == Gutsy Gibbon

April 12, 2007

Breaking news! Mark Shuttleworth announced today that the following version of Ubuntu, scheduled for release in October, will be called the Gutsy Gibbon.

Here’s the official announcement on the ubuntu-devel-announce mailing list.


Aptitude Tip: markauto and unmarkauto

April 12, 2007

Aptitude is great for package management at the command line. It is even smart enough to automatically remove packages that were installed as dependencies and are no longer needed on the system. When you install a package with aptitude, it is marked as manually installed, i.e. not automatically installed. On the other hand, if a package is installed because some other package depends on it, it is marked as automatically installed.

So far so good, but this can turn into a problem from time to time. Let’s say you’ve installed ubuntu-desktop, for example. Among other things, it automatically installed xsane, a program for scanning. Let us further presume that you liked xsane, but wish to remove ubuntu-desktop. The following command will also remove xsane, which is not what you want:

sudo aptitude remove ubuntu-desktop

That is what the markauto and unmarkauto aptitude commands are for. xsane is currently marked auto, because it was installed as a dependency of ubuntu-desktop. Aptitude tries to remove is because no other package depends on it. The solution is using

sudo aptitude unmarkauto xsane
sudo aptitude remove ubuntu-desktop

The markauto command works the other way around. It marks packages not manually installed, so they will be removed once nothing depends on them.


APT Tip: Purge Removed Packages

April 10, 2007

Many times I find the command-line utilities for package management faster and more convenient than GUI tools like Synaptic or Adept. Yet learning how to use them efficiently takes time. Here’s a trick you can use to purge packages that have already been removed with apt-get remove or aptitude remove. When a package is uninstalled, its configuration files are left on the system, in case you’ll want to install it again. Purging a package gets rid of these configuration files. This not only frees disk space, but also helps maintain the system clean. It’s easy to forget to add --purge to each apt-get remove command you run, but there’s an easy way to purge packages after you’ve removed them:

dpkg -l |awk ‘/^rc/ {print $2}’ |xargs sudo dpkg --purge

What this does is run a dpkg -l to list packages, select all lines that begin with “rc” (which means the package is removed, but its config files are still on the system), and pass them to dpkg --purge to get rid of them. Neat, huh?

NOTE: If you don’t use sudo, remove it from the command above and run the whole line as root.