Why Does Root Get a Special Home Directory
scottalanmiller last edited by
It doesn't take long of using a UNIX system before you notice that the root user by default keeps its files in /root while normal users on Linux keep them under the /home directory or something similar on other UNIX systems.
The reason for this is behavioural. In many cases, the /home filesystem, even today on personal Linux desktops, is often a separate filesystem from the root "/". This is done so that it can be cordoned off from the main filesystem so that users can't fill it up and cause the system to fail, so that backups can be more granular and because it allows for more tuning such as choosing a different filesystem or filesystem options for that data. Plus historically all of these things were split up for other reasons as well.
On larger systems it is not uncommon for /home to use a different RAID array or underlying storage location or technology making its separation even more obvious. And it is extremely common in larger businesses for /home to be remotely mounted, probably over NFS, from a centralized home directory server server so that the files are available from many different hosts.
What all of this leads us to is that under a very large number of circumstances and nearly all historical circumstances, the /home or equivalent directory was at a higher risk of not being available at boot time than was the main / filesystem - either because it introduced an additional filesystem to fail, a mount command that might be bad or missing, another array to fail, a network connection to fail or simply not being mounted because it was not needed.
This is especially critical during a system emergency or recovery. Booting into most maintenance modes to fix a failed system will not enable networking or mount a remote filesystem and any failure of the /home mount would potentially make the root user unable to function or possible not even log in. So because of this the root user is given a special /root directory that is expected to be mounted under the main / filesystem for reliability reasons.
Part of a series on Linux Systems Administration by Scott Alan Miller