Cleaning up the filesystem

Unification

© Lead Image © Viachaslau Bondarau, 123RF.com

© Lead Image © Viachaslau Bondarau, 123RF.com

Article from Issue 228/2019
Author(s):

At long last, Debian joins other Unix-like distributions in merging /usr directories.

Since 1993, the Filesystem Hierarchy Standard (HS) [1] has been the guideline for Unix-like directory structures. It requires the root directory partition to contain all the files the system needs for booting and mounting additional partitions.

This results in 14 directories or symbolic links to them: /bin, /boot, /dev, /etc, /lib, /media, /mnt, /opt, /run, /sbin, /srv, /tmp, /usr, and /var. Only the /opt, /usr, and /var folders can be located on other partitions. In addition, FHS considers the home directory to be optional, along with /root, /lib32, and /lib64.

In 2015, FHS was integrated into the Linux Standard Base (LSB). FHS is now maintained under the umbrella of the Linux Foundation.

Starting in 2012, several distributions have chosen to merge the /usr directories [2], thus modifying the FHS (and are therefore no longer LSB-compliant). Starting with Debian 10 Buster, Debian has now joined the /usr merge ranks.

Root Canal Treatment

In Debian 10 Buster, Debian makes changes to the root directory for new installations. The /usr merge aims to move the contents of the /bin, /sbin, /lib, and /lib64 directories to matching directories below /usr. For compatibility reasons, only symbolic links remain in the root directory. Thus, two directories for binary files and two directories for libraries are merged into one (Figure 1).

Figure 1: This is how the /usr merge is represented schematically in the file tree.

Debian comes to the /usr merge party relatively late compared to other distributions. As early as 2012, Fedora system developers Harald Hoyer and Kay Sievers implemented the /usr merge in Fedora 17 [3]; Solaris took the leap two years earlier with version 11. Arch Linux also started unifying the directories in 2012 and merging the /usr directories in 2013. Arch Linux also merged /bin and /sbin, which Debian doesn't intend to do at this time.

Lennart Poettering, creator of PulseAudio, Avahi, and systemd, has supported this change, because it facilitates stateless systems [4]. Following the /usr merge, it is possible to mount the immutable parts of the installed operating system with write protection, to update them atomically, or even to distribute them to several hosts or containers.

Before the /usr merge, historical partitioning was needed to mount /usr as a separate partition or across a network. The system mounts the /usr directory early on in the boot process, long before the initial RAM disk (initrd) [5].

Historically Conditioned

The roots of the historical division, where some directories are duplicated both directly below root and in /usr, date back to the beginning of Unix development in the 1970s. When Ken Thompson and Dennis Ritchie started developing Unix in 1969, storage space was limited.

In the beginning Thompson and Ritchie used floppy disks and then switched to a Digital Equipment Corporation [6] PDP-11 computer in about 1971. The PDP-11 already had a hard disk with a capacity of up to 512KB and supported a removable RK05 DECpack [7] magnetic media drive with 2.5MB, which was larger but far slower.

When the Unix root system grew beyond half a megabyte, the largest directory with the applications and tools was stored on the RK05-DECpack, which until then had contained only user data. Based on this practice, they named the mount point /usr (other sources claim that the acronym stands for "Unix System Resources"). Probably both are correct, because after the introduction of a third hard disk, the user data migrated there, making renaming meaningful.

Since the root directory was now distributed over two hard disks due to space constraints, a successful boot process required that everything on the first disk be kept accessible in order to boot the system to an extent where /usr could be mounted. This led to directories such as /bin, /lib, and /sbin being found both directly below the root and again below /usr.

Despite the advent of hard disks with sufficient capacity for the entire root system, this setup continued for many years and flowed into the FHS. Today, there is no reason to duplicate these directories. (More information on this topic can be found in an essay by Rob Landley [8]).

Penultimate

Canonical has delivered a unified /usr directory since Ubuntu 19.04. With the Debian Buster release, openSUSE will be the only major distributions that is not merging the /usr directories.

Debian started the migration in 2016, when the usrmerge package became available in the unstable branch [9]. usrmerge contains a Perl script that converts an existing system into one with a merged /usr directory. The developers also made a change to the debootstrap package so that it creates the required symbolic links itself before installing packages in a chroot.

Due to bugs that could not be fixed in time for Debian 9, the developers shifted the unification of / and /usr to Debian 10. However, during further development, other errors were made since packages created after unification would not run on unconverted systems.

Most of these bugs are now a thing of the past, or patches are available [10]. However, Debian developer Ian Jackson believes that the change could lead to more serious bugs and called on the Debian Technical Committee (TC) to postpone the /usr merge again [11]. In March, however, the TC rejected this request, so Debian 10 features the completed /usr merge [12].

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • SpiderOak

    Back up, synchronize, version, and collaborate with SpiderOak.

  • Dgit

    Dgit combines the Debian archive with a Git repository, giving package maintainers some totally new options for managing Debian source packages.

  • Next Gen Distributions

    With systemd poised to revolutionize the init process, we look at Linux distributions that have left the familiar path, use new approaches and techniques, and are paving the way for the next generation of Linux distros.

  • This Month's DVD

    Debian 9 and Tails 3

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News