Gentoo Wiki


Merge-arrows.gifIt has been suggested that this article be Merged into one article with TIP Free up disk space in Gentoo.    (Discuss)

Gentoo is, as we all know, a great distribution. Though, it is quite large (it easily uses 10 GB when you have Gnome, some games, a lot of USE flags and old files), and being able to have an installation which is much smaller in size (only a few gigabytes?) and faster in build speed would be nice. This guide will try to explain how to set up a Gentoo box in a such a light way, with or without the help of a server (your choice). Obviously, you want to be able to use it as if it is a regular desktop machine and it should not be critical if the server might fall out. For this guide, I'll assume that you're installing Gentoo and got to the point of partitioning and formatting your drive.


Filesystem-related modifications


Ext* filesystems are huge. Every file uses at least four kilobytes on your HDD. ReiserFS makes these amounts a lot smaller. Since linux has thousands of small (under 4KB) files, it is a perfect idea to use ReiserFS for about all partitions. /home could be an exception if you are going to have a lot of media in it.

Or just change the Ext* blocksize to something else using the "-b" switch of mke2fs. Something like "mke2fs -b 1024 /dev/hda1" will give you a 1k blocksize filesystem on /dev/hda1, so those thousands of small (under 4k) files will become lots of little files of 1k. That way you don't have to worry about ReiserFS's questionable stability history.


Use squashfs to compress /usr/portage (on average from 1GB down to around 200MB). SquashFS doesn't write very fast, but this is not needed for the portage tree, as this isn't updated very frequently.


We want our server to store non-critical files, mainly portage (unless you've already mounted portage using SquashFS) & friends. To do this, we'll start with some space on the server. If you want it as a separate partition, make that using fdisk. There is no explicit need for this, though. As the server runs gentoo as well, you can use the same /usr/portage/ tree.

NFS mounting

You can choose to share the tree via NFS now, which has a small speed advantage. Share it using NFS, as described here.

Warning: Warning: this setup does not (yet?) support mounting over the internet, or at least it'll be very insecure. Maybe try tunnelling this through SSH?

SFTP mounting

Warning: This section is not yet done

You can also use SFTP to read and write from and to the tree. It is slightly slower than NFS, but it has the advantage of easily being able to mount over the internet.

Q: Why not FTP?

A: FTP is not available using FUSE in the portage tree at the moment of writing, for detailed information, see Mounting SFTP and FTP shares. SFTP is nice because it encrypts data and thus is more secure than NFS (which doesn't really have any kind of security).

# emerge fuse sshfs-fuse
# modprobe fuse # You might want to put fuse in /etc/modules.autoload.d/kernel-2.6

Finishing partitioning

Once you have used any of the hints described above and partitioned your system correctly, continue installing Gentoo like described in the Gentoo Handbook. After you have installed a stage, return to this page for further instructions on how to setup the rest of your system in a light way and keep your system small.

make.* stuff

After this basic installation, we're going to make your the rest of your system (mainly GUI-related stuff) depend on fewer packages and haver smaller binaries. I'm going to assume you have /etc/make.profile set to /usr/portage/profiles/default-linux/x86/2007.0/desktop/make.defaults. Of course, the corresponding amd64 profile won't differ a lot, but please pay more attention. Now, /etc/make.conf can be configured to make your system lighter. We'll edit it again later in this guide for some compiling features, but for now only these modifications are needed:

File: /etc/make.conf
CFLAGS="-Os" # add any flags you like here -march flags could be quite useful
USE="-gnome -kde minimal -qt3 -qt4" # these should make sure the heavy stuff doesn't get installed.
PORTAGE_NICENESS="15" # When you're building while working, portage might need a lot of your system resources.

To have all applications be compiled with -Os, I recommend you to emerge -e world now.

# emerge -e world

Switch off loggers

/var can get pretty big if you log everything blindly. Switch off logging for a lot of applications. One of the things you can switch of is syslog-ng:

# rc-update del syslog-ng

If you have a different logger, substitute it's init.d script with the one above, obviously.

(yet to be written. this part should contain an overview of applications you might want to switch off logging for)

Or use remote logging

You can also send logs over the network. Please see HOWTO create a logserver with syslog-ng to accomplish this.

Extra: ionice

On computers with slow harddrives, being able to "nice" the I/O as well would be nice. Guess what: You can! The tool ionice is available in >=schedutils-1.5.0. Update to this version before continuing. To make any app ionice'd as well, just run it like this:

$ ionice nice -n 15 ./fooapp

Portage does not yet know about ionice, so we'll have to fix that.

Option one: create /bin/nice

I did this by making a new file in /bin, called nice.

File: /bin/nice

ionice -c2 -n7 nice "${@}"

Then, a single bless makes your build actions nearly unnoticable:

# chmod a+x /bin/nice

Because files in /bin have preference over /usr/bin (assuming /bin comes first in PATH), our little script will be called instead of the binary installed nice executable.

Option two: bash alias

An rather less problematic alternative would be to add a variant of the following line to ~/.bashrc:

alias nice='ionice -c2 -n7 nice'

(more configuration to be added, please add your ideas)

Portage support will be added soon

According to portage will support ionice in the next version.

Distributed building and build caching

(yet to be written, don't forget to let all builds be saved on the server)

Desktop Environment

Now, it's time for some GUI. First Install Then, you may want to have a light desktop environment (at least I do). Gnome is heavy and KDE is huge too.

Option one: Xfce

Although not the lightest on the market, Xfce is far from a heavyweight, still it offers a very complete environment. We'll have to choose some extra packages to get to all the features you know from Gnome though.

# emerge xfce4 thunar-volman thunar-archive xfce4-taskmanager xfce4-systemload

There are a lot more options you probably like, but this depends on your hardware setup. Refer to:

$ emerge --search xfce4-

or, if you have eix (wonderful tool):

$ eix xfce4-

for an overview of some useful packages. Maybe you also want to be able to change the GTK+ theme. If so, check TIP Change Appearance of GTK Applications.

Option two: Enlightenment 16

Older version of Enlightenment Window manager, but still being maintained and improved. Lighter than xfce, but it might look far better even on older configurations. Good window moving, multiple/virtual desktop animations. Some say that its pager is the best one available. It doesn't support compiz, but has some own composite effects. To use it, just emerge x11-wm/enlightenment. ~arch versions are feasible and generally safe to use. For configuration, emerge e16keyedit and e16menuedit and see ~/.e16/, config files are text, safely editable by hand.

Note: This is no "older version" of Enlightenment 17. DR17 is a total rewrite, and mostly a different project

Option three: Enlightenment DR17

You can also choose Enlightenment DR17. It's pretty light, but some people don't like its looks. See Enlightenment DR17.

Note: Some people may not like its looks, but for many it's Enlightenment's main selling point

Option four: just a WM

You can also simply not install a desktop environment at all and go for something like Fluxbox, JWM or IceWM

Office suite

Which office suite you should use depends on what you're going to use the installation for. If it's pure office work, then OpenOffice might do the trick. If you're going to edit a single file every now and then, then OpenOffice will take too much time to load. Abiword is nice and clean, but misses some features. KOffice involves having to install QT libraries, which means another big load, unless you already use some Qt applications. In summary:

Notepad equivalent

Deleting unnecessary files

There are a couple of directories which are not always worth fully keeping. They can absorb a vast amount of disk space, so you should make sure you clear them every now and then if you don't need them anymore.

/tmp clearing

To start with, /tmp is a directory which has a lot of unused files which should be cleared, but have not been. Please refer to HOWTO clean /tmp for more information on this.


Another useful tool is eclean. eclean can clear tarballs you no longer need and obsolete binary packages. To start using eclean, simply emerge gentoolkit if you do not have it yet:

# emerge -av gentoolkit

If you want to clear all distfiles which are older than the currently installed corresponding packages, run:

# eclean-dist -d

If you're a buildpkg or buildsyspkg guy, you should also run:

# eclean-pkg -d

Remove old kernel sources

If you've updated a couple of times, you might notice that you have too many kernels installed. To remove these, run:

# emerge -Pav gentoo-sources # Substitute with your kernel here

You should run this after every kernel update

/var directories

Like written above, /var/tmp is already mounted on your server. Still, it could be a good idea to clear the CONTENTS of /var/tmp/portage every now and then, as it can get pretty huge when you break a lot of builds.

# rm -rf /var/tmp/portage/*
Warning: DO NOT RUN THIS WHILE COMPILING!!! You should only clear /var/tmp/portage/ when emerge is doing absolutely nothing!

Doing these things as a cron job

(yet to be written. be careful with the emerge commands)

Some general advice

If possible always check for software alternative that uses smallest / fewer dependencies, 'emerge -vp' will help. eg. Pidgin (formerly GAIM) (bloated with gnome deps) vs aMSN (lighter), gnome-terminal vs aterm, rox vs filer, evolution vs sylpheed and many more.

Always stick to one group of dependencies (GTK without GNOME or QT without KDE)

(more ideas to be added)

compile with "doc" USE flag only for specific packages in /etc/portage/package.use, NOT as a global use flag in /etc/make.conf

See also

External links

Retrieved from ""

Last modified: Sat, 04 Oct 2008 14:33:00 +0000 Hits: 19,465