Mastering Gentoo

Add the meaningful to the Wiki


The common desktop Linux variants like Fedora, Ubuntu or Debian have an installer that gets the average computer up and running within a few hours. Its result is an absolutely usable desktop environment. But Linux is so much more. When using Linux From Scratch, Arch Linux or Gentoo you end up touching a mirror turning your finger into liquid metal. Either panick now or see behind the Matrix. This is the first part of 4 starting with suggestions for filesystem layout.

You can run any Linux fine without any swap. I normally provide 4GByte of swap if it is a desktop system. When hibernating an image of the system RAM is put there. Normally I supply 16GByte of RAM. Servers get a lot more, depending on the purpose. All my Raspberry PIs run without any swap unless they have a harddisk attached. None of them is a desktop system but a dedicated and often headless worker. Their configuration is tweaked so that for example a web server's cache fits into the RAM. So no swap allows the SD card to be read only – requiring minor tweaks of logging since system state under /run is already a tmpfs. Then it is safe to simply turn off the Raspberry PI without any corruption of the SD card. All USB disks have a journaling file system.

According to Linux Standard Base I always move Gentoo's distfiles and binary packages to /var which is always a separate partition of 40GByte. Monitoring of such a separate partition is easy and as soon as it reaches 70% usage a job wipes it. This saves the entire system from blocking due to lack of disk space to create temporary files or such.

All my portable computers have no extra partition for /usr. With a single built-in harddisk it doesn't make any sense to split root or / and /usr. But they have a separate /var partition. All full size PCs have split partitions and follow the suggestions of Early Userspace Mount. This saved me from at least two failures. I can mount root itself read-only and repair/ restore journal of /usr seperatly. Also /boot is never mounted during regular operation. I use the following sizes for the partitions:

These days all remaining mount points holding system state like /tmp or /run come as tmpfs/ RAM disk. So they can't pile up beyond reboots and can also be monitored quite easily. I also use a tmpfs for /var/tmp/portage enabling builds to happen in RAM. Nowadays this requires 10GByte or more for builds of Rust. Libreoffice and web browsers get along with 8GByte.

Upcoming parts:

See also:

Update 2020-12-07T15:00:00

After publication questions arose regarding power states of Raspberry Pis, this is asked very often everywhere. None of the current models have additional power down states. There is a halt state but it consumes nearly the same amount of power like a working Pi. Basically it would be possible to have a hibernation state. It is a kernel thing to create the system image, put it on a persistent storage and read it again when powering up. None of the available OS variants support this dirty hack. In addition it is not that easy to power up the Pi again: USB is disconnected, no OS running in hibernation. Full scale computers have BIOS support, doing the basic I/O and booting up again.