home
linux
join
mailing list
meetings
Administrative
Links
Tips and Tricks
TIPS-AND-TRICKS: Saving disk space
Here are some tips for saving disk space:
Download UPX from upx.sourceforge.net Lovely little tool - transparent executable compression with almost no overhead - apps load slightly slower but run just as fast.

cd /usr/bin
upx *

Repeat for /usr/local/bin etc. You *COULD* run it on the sbin directories but somehow I think that is just a little too risky nay. Anyway those are small. The website also says you can compress kernels with it, but in my experience even though upx has better compression than gzip it is still slightly less than bzip which is the kernel standard.

Next point: Here is a simpler version of Michaels script that doesn't require xdialog and can easilly be adapted for other useless files (E.G. README - but check before)

locate COPYING | xargs rm -f

Next do this:
cd /usr
tar jxvf doc.tar.bz doc/
rm -fr doc/
mkdir doc
cd share
tar jxvf doc.tar.bz doc/
rm -fr doc
mkdir doc

This will stick all your documentation in bz compressed archives. Since any decent file manager can browse those directly they are still easilly be accessible but in my case takes around 10% of the orriginal space (bzip2 rocks on text files) Do remember to recreate the dirs (it's easy to add them again later) or you will break install scripts. Also you can do this on /usr/local as well.

In redhat /dev/shm is by default unmounted. This is a very usefull adition to kernel 2.4+ - the virtual memory filesystem - which allows you to create a filesystem that only exists in VM and is destroyed at boot time. Open /etc/fstab in you favorite text editor and locate /dev/shm 's line. Change the "none" in the beginning to /tmp and reboot - you will be amazed at how much stale files can build  up in /tmp

If you want to keep your kernel sources, bzip2 them up again - just don't do it include/linux or you will break ALL c compiles.



Michel's tip for handling massive Mandrake Cooker downloads:

I really needed to get a grip on my collection of rpm's. I use Mandrake, and my nightly visits to the cooker was taking over my hard disk . Cooker files are officially 'unstable', so you do want to keep a previous version of whatever you install, just in case something goes wrong. I manually move mine into /var/cache/grpmi/used , but wherever you stick them, all those updates start adding up.

"... and to your right, ladies and gentlemen, we have Michel's collection of kdebase-2.2.2 files, each one weighing in at 16 megabytes ..."

Problem is, once you are happy that fubar-12.3.rpm is working, you no longer want fubar-12.2 to take up disk space. I tried deleting such duplicates by hand for a while, but this is exactly the kind of thing computers are supposed to liberate us from, isn't it?

Time to make a compromise: from my knowing from experience how often the really important files in the cooker are updated, I decided that I could live with a month's worth of rpm's.  That should enable me to recreate my QT/KDE, GTK/Gnome and X11 libraries, and almost all my apps.

From there it was easy:
-----------------
cd /var/cache/grpmi/used

for i in `find -ctime +30`
do
rm -f $i
done
---------------

... and anything in that directory downloaded more than 30 days ago is wiped out.

Or, if you like, that last part can be typed on a single line

for i in `find -ctime +30`; do rm -f $i; done

To change this to a two-month supply of rpm's, just change the "+30" to "+60". This should work on just as well on deb's or any other directory full of stuff that regularly gets replaced with newer versions.