When working with Unix/Linux, I get that disk spaces are divided in partitions, that may or may not be fed with different filesystems that can be mounted anywhere on the 'root filesystem'.

Filesystems are then mounted on locations on this root filesystem, but how does Linux builds this first initial root filesystem (starting at '/')? How is it merging my different filesystems in a unique one that I can navigate from root?

  • The kernel doesn't need to mount a filesystem to access it, only userspace needs that. So, depending on your configuration, kernel expose the first root filesystem (disk or initramfs) as the VFS /, then userspace begins and demand the kernel to mount other filesystems. Normally you would use a initramfs, which totally get uncompressed into memory – 炸鱼薯条德里克 Jan 20 '19 at 8:54
  • Thank you for your answer. So initramfs does the trick if I understand correctly. Is it correct to say that root is at the top of the inode hierarchy then? And that everything is linked from there (from a memory perspective)? – devconnected Jan 20 '19 at 9:04
  • It's not an answer, it's a question comment. Question comments are meant to be about clarifying and improving the question. Actual answers would appear below under a heading. So-called comment answers should always be taken with a pinch of salt. – JdeBP Jan 20 '19 at 10:26
  • No there is nothing special about initramfs (with respect to this question). And no not top of inode hirarchy. See my answer. – ctrl-alt-delor Jan 20 '19 at 12:03

The first one is mounted as root. That is whichever file-system that is marked as the root-file-system is mounted as the root-file-system. Then other file-systems are mounted on top of (usually empty) directories of already mounted file-systems (not necessarily the root file-system).

For example, if we mount A then B then C then D, A is root, then B can be mounted on A, then C can be mounted on A or B, and then D mounted on A or B or C.

Notes on one of your comments

No there is nothing special about initramfs (with respect to this question).

No not top of inode hirarchy


  • stat /, on my system it has inode 2.
  • stat /home, on my system it has inode 2.

How can this be?

  • stat /, on my system it has device 2049.
  • stat /home, on my system it has device 2051.

Therefore a file must be identified by the bi-tuple device,inode.

|improve this answer|||||
  • "Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined? – devconnected Jan 20 '19 at 14:00
  • From the last part of your comment, I understand that "/home" belongs to a different device. From that point, it would mean that files inside /home are derived from this initial inode 2, am I correct? – devconnected Jan 20 '19 at 14:01
  • Yes /home is a different device on my machine. File-systems are marked as root in the partition table, so the kernel mounts it first as the root fs. – ctrl-alt-delor Jan 20 '19 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.