Filesystems and the single-user mode
Hierarchy
maddog explains the importance of single-user mode and filesystem hierarchy standards.
A friend of mine was trying to shut his system down to single-user system (SUS) mode. Although many modern-day GNU/Linux users probably do not know what SUS is, the "old people" who are familiar with Unix and earlier versions of GNU/Linux certainly are aware of it.
SUS is when most of services – such as web servers, database engines, and other "service" features – are shut down. Users (even local users) cannot log onto the system and, typically, the graphics from the X Window System are also turned off. More importantly (for my friend), all of the filesystems other than the root filesystem (represented by /) are unmounted and idle.
In this state, the systems administrator can fix many things that are wrong without completely shutting down the system and turning off the power. In this state, the admin can move things around in the filesystems or make a filesystem bigger or move it to another disk.
However a filesystem cannot be cleanly unmounted if an application is still using it, so applications tend to be placed in the file tree according to when they are needed. To explain this, I must go back in time…
GNU/Linux is based on the Unix operating system, which was started in 1969. At the time, a disk that was 5 or 10 megabytes was considered large, and even though Unix systems of the time were textually oriented (avoiding the large storage needs of audio, video, and graphical interfaces), they were still time-sharing systems and needed more storage space than a single 5MB disk could supply.
Therefore, Ken Thompson and Dennis Ritchie developed an extensible filesystem in the tree-like fashion that we all know and love. They also developed directories as "mount points" so the filesystem could literally be extended as far as people wanted (with as many disks as the machine could handle). The only limitation was that a filesystem could not span a disk drive. This limitation was overcome eventually by the use of virtual disks, or volumes, but for most filesystems, the same limitation exists today.
This system was set up so it could perform such functions as boot, launch the kernel, access most (if not all) of the devices, do backups of the filesystems, and do filesystem work. (Networking was typically not turned on in single-user mode.) The filesystems of the day were not as robust as most GNU/Linux filesystems, and often after a crash, you needed to run a program called fsck to check and fix the filesystems; otherwise, filesystem damage could occur that would eventually make the filesystem unusable.
Another advantage of the filesystem tree was to give systems administrator some leverage as to what type or speed of device they could use. If there was an application such as a database engine, for example, the administrator could put it on its own device and make sure the device was a large, fast one. To the user, it would look like just another part of the filesystem.
The system was set up to reflect this filesystem hierarchy. However, because there was also a policy of having binaries in /bin
and libraries in /lib
with everything else in /etc
, when the filesystem expanded to include /usr
, it was decided to put the things used by all users in /usr/bin
, /usr/lib
, and /usr/etc
to allow more binaries and libraries than what a 5MB disk could hold.
Likewise, a user could have a ~/bin
, ~/lib
, and ~/etc
in her own home directory. This meant that all of the applications that needed to run in single-user mode (when no other filesystems were mounted) had to have all of their associated binaries in /bin
, libraries in /lib
, and other files handily in /etc
.
Thus, began my friend's problems. He wanted to take the system down to single-user mode and unmount the /usr
filesystem to do some work on it. However, once in single-user mode, he could not umount /usr
because dbus was using some libraries in /usr/lib
and he could not run the system without dbus.
He went onto Facebook and started complaining about this to his friends. They belittled him because the days of 5MB disks are gone now, and they called him "old." He replied, saying there was a standard called the Filesystem Hierarchy Standard (FHS), which states that programs that run in single-user mode need to have all of their binaries and libraries in the root filesystem. People laughed at that, too.
It is not a laughing matter. The FHS was written with a lot of care and thought as to how a Unix (and GNU/Linux) system should run. People need the concept of a standalone root filesystem, and we need to keep checking that we can still do this.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.