When installing Ubuntu for the first time, I separated
home into different partitions. Thinking back on it, how is this possible?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
A partition can contain a file system. Linux can mount a file system at a mountpoint (a directory). This mountpoint can be in another file system's directory tree, and the mountpoint
/home is in the root directory
Mounting means that the content of the mounted directory is available via the mountpoint. This means that the home directory is in the root directory (directory tree), but it is still located in an own file system in an own partition.
You might want to read the manual page entry for the
mount command: https://www.man7.org/linux/man-pages/man8/mount.8.html
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at
/. These files can be spread out over several devices.
The file hierarchy is a way of logically organizing the files on your system but is not really representative of how the files are physically stored.
There is a a little confusion between the structure of the file system (as a hierarchical database) and the presentation of hierarchical directory tree in the running system.
Each hierarchy has some root. Therefore, each hierarchical filesystem has its own root.
But when they get mounted, their roots are mapped to some place in the in-memory hierarchy somewhere within VFS layer. So indeed, while the contents of your
/home is a root of that filesystem, when it is mounted as
/home, its content is being presented under that path. The confusion is rooted in the fact there is an important single file system, called "the root" which gets mounted to the root of the in-memory hierarchy and so its root becomes the root of the in-memory hierarchy.
In various situations, you may see those file systems mounted into alternate paths. The usual cases are:
/target, Gentoo Handbook recommends to mount it at
/mnt/gentooand so on). That is partially explained by the fact the installer itself is an application running on top of the OS, which already has its own root file system mounted and required to operate.
/newroot), and then a switch is performed, so the kernel switches from one root to another at runtime. (The memory that was occupied by the
initramfsis then released and returned to general use.) If you see a debug initramfs shell in the boot menu, that is the way to stop the boot process right before the switch, so you can explore how the system looks at that stage.