compressing filesystem (2)

Given the fact most operating system files are almost never used, essentially these files

are slack. OK they have to be there, belonging to an installation, and the software eventually is used in very few cases.

Actually this can be 10,000s of files. If a special program option is not called, they are never loaded at all. So why not, at least compress them? A gigabyte here, a gigabyte there. It makes a hudge difference on a small 30GB hard drive.

Having a Pentium III, there is little penalty decompressing some 10s of megabytes while starting a software. Uncompressed, about 15 MB/s reading, and compressed, about 10 MB or less.

Compression is of course not good for JPEG, or database, and other certain types of files.

So it is good if the file system can just turn on/off compression.

BTRFS (Linux) can do just that:

1. remount a live partition with -o remount and -o compress.

2. make a copy of the directory (with -r)

3. rename the original directory

4. rename the copy

5. delete the renamed, original copy.

If you make a mistake, it might be you have to reinstall completely.

So better double check in a file manager. Also only rename from bash (not with GUI).

You can type mount, and you’ll see the remounted partition is using compression now.

Before compressing /usr/lib, 41% was used. After that, only 35%!

/opt was also compressed on a new, seperate partition.

Before of that, root (/) was actually 98% full.

It is selective compression. Most of the files are never loaded.

It makes no difference for performance. But much more stuff can be fitted!

Some file types are already compressed so it is total nonsense to try compress them.

Anyway, BTRFS will skip such files even with compression = ON.

BTRFS is still experimental, but it works good enough on a laptop to copy back and forth several gigabytes, and to compress in order to have more space available.

A 30GB disc can easily hold 50GB or more real data.

If you have 3 gigabytes of C header files, you should really compress them, if they are almost never used, just have to be there for some special case. Because a text file can compress by nearly 90%.

Some directories like /var dont compress well especially the repository. Guess why- these files are already highly compressed. Before you reinstall, you should backup the repository, and then copy back directly after reinstallation. It can take quite a while to download again.

f:id:hitechworld:20130920065651j:image:w640

By the way I edited the screenshot with GIMP directly after compressing /usr/lib, so actually it works without any change to the /usr/lib structure.

If you don’t understand the copy command, really think two times what you are doing, and double check before removing the old structure. There is no easy undelete on LINUX like as for Windows. If you ROOT, and remove some essential files, it will not startup again next time, and it can be nearly impossible to repair, even if you know what is wrong now.

But it is worth it. I have my root partition from 98% full back to 35%, and all files still there.

There was also a free chunk at the end of the hard drive- about 5 Gigabyte. I booted with live DVD, resized the extended partition, and created a new logical partition, then moved /opt to this place.

Remember there are often 20 to 30 individual steps, and they all must be exactly right. Even if there is more than one way sometimes. It is not so hard after a while, and not impossible. But if you try an idea for the first time, there is always a risk. You could end up with not booting laptop…

OK. I finished writing. The same moment…a message appears. Your browser has been updated and need to be restarted. Wow. Really the same moment!!! What can I say. Press that japanese “save” button, and then Restart…I mean, don’t press the wrong button or all your writing goes to nowhere.

Leave a Reply

Your email address will not be published. Required fields are marked *