How are filesystems merged and presented in a common filesystem when booting a Linux machine?
Clash Royale CLAN TAG#URR8PPP
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?
linux filesystems
add a comment |
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?
linux filesystems
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 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)?
– Tavarich
Jan 20 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 at 10:26
No there is nothing special aboutinitramfs
(with respect to this question). And no not top of inode hirarchy. See my answer.
– ctrl-alt-delor
Jan 20 at 12:03
add a comment |
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?
linux filesystems
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?
linux filesystems
linux filesystems
asked Jan 20 at 8:47
TavarichTavarich
173
173
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 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)?
– Tavarich
Jan 20 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 at 10:26
No there is nothing special aboutinitramfs
(with respect to this question). And no not top of inode hirarchy. See my answer.
– ctrl-alt-delor
Jan 20 at 12:03
add a comment |
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 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)?
– Tavarich
Jan 20 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 at 10:26
No there is nothing special aboutinitramfs
(with respect to this question). And no not top of inode hirarchy. See my answer.
– ctrl-alt-delor
Jan 20 at 12:03
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 at 8:54
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 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)?
– Tavarich
Jan 20 at 9:04
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)?
– Tavarich
Jan 20 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 at 10:26
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 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 at 12:03
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 at 12:03
add a comment |
1 Answer
1
active
oldest
votes
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
Try
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.
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 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 at 14:12
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495579%2fhow-are-filesystems-merged-and-presented-in-a-common-filesystem-when-booting-a-l%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
Try
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.
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 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 at 14:12
add a comment |
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
Try
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.
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 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 at 14:12
add a comment |
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
Try
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.
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
Try
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.
edited Jan 20 at 12:03
answered Jan 20 at 11:50
ctrl-alt-delorctrl-alt-delor
11.2k42058
11.2k42058
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 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 at 14:12
add a comment |
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 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 at 14:12
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 at 14:00
"Whichever filesystem marked as the root-file-system", what do you mean by "marked", how is that defined?
– Tavarich
Jan 20 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?
– Tavarich
Jan 20 at 14:01
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?
– Tavarich
Jan 20 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 at 14:12
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 at 14:12
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495579%2fhow-are-filesystems-merged-and-presented-in-a-common-filesystem-when-booting-a-l%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 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)?
– Tavarich
Jan 20 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 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 at 12:03