4

i know that one reason for /root not being in /home is that usually /home is mounted on a different disk and if it were to fail, we still want root to be accessible. What are some of the other reasons for this structure?

dor
  • 77
  • 1
  • 6
  • 9
    Try to add a *clear problem statement* to your question. Surely you are content with other design choices that have zero or one reason.. so if you spell out the reason you are looking for additional explanations here, you might get a better answer. – anx Jun 27 '21 at 09:32
  • 1
    Beyond the reason you give, for certain setups, the root home directory needs to be accessible during boot before the filesystem containing home is mounted... – Eric Towers Jun 27 '21 at 21:27
  • 1
    Does this answer your question? [In Linux, why isn't superuser root's folder under /home?](https://serverfault.com/questions/398355/in-linux-why-isnt-superuser-roots-folder-under-home) – phuclv Jun 28 '21 at 01:32
  • That's one very good reason, who needs more? – hobbs Jun 28 '21 at 03:03
  • phuclv, that does not answer the question. I was asked to find more answers other than that of /home is mounted on a different device, and was wandering if anyone here had more reasons. – dor Jun 28 '21 at 06:23
  • FYI, in earlier Unix systems root's home directory was `/`, not `/root`. Which may be why it was named "root". – Barmar Jun 28 '21 at 07:35

2 Answers2

12
  1. composability

    You want to build/diagnose/repair a system using that same system, so it makes sense to keep the next upper layer (multi-user features) independent from the lower layers. Many systems to this day equate recovery with single-user: not a special mode, but a merely a lack of some features built on top of it. And if /home is part of a layer on top of single-user systems, it cannot contain single-user essentials.

  2. privacy

    You should keep personal data separated from system data. Enforcing this separation even when not also expressed in distributing across different mounts makes sense to simplify safe defaults for common operations: Only multi-user directories require explicit exclusion when doing a system backup - the root users directory being considered system, not personal data here.

These two may not be strictly equal to the /home is a nfs use case, but obviously still strongly related. My main answer is and remains: being able to handle /home mounted from a different device is a good reason and when designing low-level software, one good reason is already enough.

anx
  • 6,875
  • 4
  • 22
  • 45
  • 1
    Hmmm; I recall more than one system that when booted single user just didn't start the multi-user component; this resulted in getty directly starting /sbin/sh with HOME=/ like it is in the early boot env disregarding user login. This would let you boot single user with things like a damaged /etc/passwd or a lost root password. – joshudson Jun 28 '21 at 04:02
7

Personally - without having read into *NIX (UNIX/Linux) design for a long time, I'd say you've likely answered you own question (/most likely implied the main reason), in that it boils down to recoverability/the bare-bones running system (- the *NIX equivalent of Windows 'Safe Mode'); what is the bare-minimum you need to be able to run the O/S (?) - should you need to diagnose an issue and work your way up step-by-step, i.e. mount one filesystem and/or start one service one at a time (- i.e. with the fewest dependencies/mandatory facets necessary to allow the system to spin-up successfully/be up & running so that an administrator is more likely to be able to initiate the diagnostic process).