Does order of mount operations matter when mounting into an existing mountpoint?
The question Best practice when mounting a new disk within an existing mount?
inspired me to ask this follow-up question:
The other question asked whether it is ok to
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
so that /home/mythtv
is a mountpoint within the mountpoint
/home
. (spoiler: Yes, it is perfectly ok.).
What if I'd change the order of commands to
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
Will that yield the same result or will /home/mythtv
be hidden by /home
?
I assume /home
contains an (empty) directory /home/mythtv
.
mount
add a comment |
The question Best practice when mounting a new disk within an existing mount?
inspired me to ask this follow-up question:
The other question asked whether it is ok to
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
so that /home/mythtv
is a mountpoint within the mountpoint
/home
. (spoiler: Yes, it is perfectly ok.).
What if I'd change the order of commands to
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
Will that yield the same result or will /home/mythtv
be hidden by /home
?
I assume /home
contains an (empty) directory /home/mythtv
.
mount
add a comment |
The question Best practice when mounting a new disk within an existing mount?
inspired me to ask this follow-up question:
The other question asked whether it is ok to
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
so that /home/mythtv
is a mountpoint within the mountpoint
/home
. (spoiler: Yes, it is perfectly ok.).
What if I'd change the order of commands to
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
Will that yield the same result or will /home/mythtv
be hidden by /home
?
I assume /home
contains an (empty) directory /home/mythtv
.
mount
The question Best practice when mounting a new disk within an existing mount?
inspired me to ask this follow-up question:
The other question asked whether it is ok to
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
so that /home/mythtv
is a mountpoint within the mountpoint
/home
. (spoiler: Yes, it is perfectly ok.).
What if I'd change the order of commands to
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
Will that yield the same result or will /home/mythtv
be hidden by /home
?
I assume /home
contains an (empty) directory /home/mythtv
.
mount
mount
asked yesterday
PerlDuck
5,43911231
5,43911231
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Yes, it matters! Your first example:
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
is the only right way, when mounting you must respect the tree order.
In your second example,
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
If we are assuming /home/mythtv
exists on the filesystem, it is gonna mount it with no problem, but after you mount the second volume you won't be able to access the first one anymore.
This is because you let the system mount sdb2
on an existing path at /home/mythtv
. When you mount on /home/
, you are telling your system to mount it on the /home
path which also exists but is going to "cover" existing mount point. They are both mounted, but when you type cd /home/mythtv
, Bash takes you to sdb1:/home/mythtv
instead sdb2:/home/mythtv
because they are different paths.
I hope the explanation is clear. If not, please ask in the comments, I'll try to get it to you more clearly.
Update
as per @mook765's comment, the order is important also in the fstab
files:
The fstab
file is read up to down while mounting, and down to up when umounting. In another case, if you try to umount /home
before /home/mythtv
mount will tell you the /home
resource is busy because you have the /home/mythtv
mounted and it cannot handle it.
2
@PerlDuck This is also important for/etc/fstab
, line order matters.
– mook765
yesterday
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would/etc/fstab
be used for unmounting? The only thing I could think of isumount -a
, but that command looks at what's actually mounted, not/etc/fstab
.
– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1106879%2fdoes-order-of-mount-operations-matter-when-mounting-into-an-existing-mountpoint%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
Yes, it matters! Your first example:
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
is the only right way, when mounting you must respect the tree order.
In your second example,
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
If we are assuming /home/mythtv
exists on the filesystem, it is gonna mount it with no problem, but after you mount the second volume you won't be able to access the first one anymore.
This is because you let the system mount sdb2
on an existing path at /home/mythtv
. When you mount on /home/
, you are telling your system to mount it on the /home
path which also exists but is going to "cover" existing mount point. They are both mounted, but when you type cd /home/mythtv
, Bash takes you to sdb1:/home/mythtv
instead sdb2:/home/mythtv
because they are different paths.
I hope the explanation is clear. If not, please ask in the comments, I'll try to get it to you more clearly.
Update
as per @mook765's comment, the order is important also in the fstab
files:
The fstab
file is read up to down while mounting, and down to up when umounting. In another case, if you try to umount /home
before /home/mythtv
mount will tell you the /home
resource is busy because you have the /home/mythtv
mounted and it cannot handle it.
2
@PerlDuck This is also important for/etc/fstab
, line order matters.
– mook765
yesterday
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would/etc/fstab
be used for unmounting? The only thing I could think of isumount -a
, but that command looks at what's actually mounted, not/etc/fstab
.
– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
add a comment |
Yes, it matters! Your first example:
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
is the only right way, when mounting you must respect the tree order.
In your second example,
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
If we are assuming /home/mythtv
exists on the filesystem, it is gonna mount it with no problem, but after you mount the second volume you won't be able to access the first one anymore.
This is because you let the system mount sdb2
on an existing path at /home/mythtv
. When you mount on /home/
, you are telling your system to mount it on the /home
path which also exists but is going to "cover" existing mount point. They are both mounted, but when you type cd /home/mythtv
, Bash takes you to sdb1:/home/mythtv
instead sdb2:/home/mythtv
because they are different paths.
I hope the explanation is clear. If not, please ask in the comments, I'll try to get it to you more clearly.
Update
as per @mook765's comment, the order is important also in the fstab
files:
The fstab
file is read up to down while mounting, and down to up when umounting. In another case, if you try to umount /home
before /home/mythtv
mount will tell you the /home
resource is busy because you have the /home/mythtv
mounted and it cannot handle it.
2
@PerlDuck This is also important for/etc/fstab
, line order matters.
– mook765
yesterday
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would/etc/fstab
be used for unmounting? The only thing I could think of isumount -a
, but that command looks at what's actually mounted, not/etc/fstab
.
– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
add a comment |
Yes, it matters! Your first example:
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
is the only right way, when mounting you must respect the tree order.
In your second example,
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
If we are assuming /home/mythtv
exists on the filesystem, it is gonna mount it with no problem, but after you mount the second volume you won't be able to access the first one anymore.
This is because you let the system mount sdb2
on an existing path at /home/mythtv
. When you mount on /home/
, you are telling your system to mount it on the /home
path which also exists but is going to "cover" existing mount point. They are both mounted, but when you type cd /home/mythtv
, Bash takes you to sdb1:/home/mythtv
instead sdb2:/home/mythtv
because they are different paths.
I hope the explanation is clear. If not, please ask in the comments, I'll try to get it to you more clearly.
Update
as per @mook765's comment, the order is important also in the fstab
files:
The fstab
file is read up to down while mounting, and down to up when umounting. In another case, if you try to umount /home
before /home/mythtv
mount will tell you the /home
resource is busy because you have the /home/mythtv
mounted and it cannot handle it.
Yes, it matters! Your first example:
mount /dev/sdb1 /home
mount /dev/sdb2 /home/mythtv
is the only right way, when mounting you must respect the tree order.
In your second example,
mount /dev/sdb2 /home/mythtv
mount /dev/sdb1 /home
If we are assuming /home/mythtv
exists on the filesystem, it is gonna mount it with no problem, but after you mount the second volume you won't be able to access the first one anymore.
This is because you let the system mount sdb2
on an existing path at /home/mythtv
. When you mount on /home/
, you are telling your system to mount it on the /home
path which also exists but is going to "cover" existing mount point. They are both mounted, but when you type cd /home/mythtv
, Bash takes you to sdb1:/home/mythtv
instead sdb2:/home/mythtv
because they are different paths.
I hope the explanation is clear. If not, please ask in the comments, I'll try to get it to you more clearly.
Update
as per @mook765's comment, the order is important also in the fstab
files:
The fstab
file is read up to down while mounting, and down to up when umounting. In another case, if you try to umount /home
before /home/mythtv
mount will tell you the /home
resource is busy because you have the /home/mythtv
mounted and it cannot handle it.
edited yesterday
Dan
6,97434373
6,97434373
answered yesterday
AtomiX84
32018
32018
2
@PerlDuck This is also important for/etc/fstab
, line order matters.
– mook765
yesterday
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would/etc/fstab
be used for unmounting? The only thing I could think of isumount -a
, but that command looks at what's actually mounted, not/etc/fstab
.
– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
add a comment |
2
@PerlDuck This is also important for/etc/fstab
, line order matters.
– mook765
yesterday
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would/etc/fstab
be used for unmounting? The only thing I could think of isumount -a
, but that command looks at what's actually mounted, not/etc/fstab
.
– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
2
2
@PerlDuck This is also important for
/etc/fstab
, line order matters.– mook765
yesterday
@PerlDuck This is also important for
/etc/fstab
, line order matters.– mook765
yesterday
1
1
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
Yes Absolutely, @mook765 say the true, fstab file when mount is read up to down, and when umount down to up, in other case if you try to umount /home before /home/mythtv mount will say to you the /home resource is busy, because have the /home/mythtv mounted and cannot handle it.
– AtomiX84
yesterday
In which cases would
/etc/fstab
be used for unmounting? The only thing I could think of is umount -a
, but that command looks at what's actually mounted, not /etc/fstab
.– kasperd
yesterday
In which cases would
/etc/fstab
be used for unmounting? The only thing I could think of is umount -a
, but that command looks at what's actually mounted, not /etc/fstab
.– kasperd
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
by reading here seems it also used by umount: man7.org/linux/man-pages/man5/fstab.5.html, anyway after thinking a while on this (if you can confirm to me) the umount go to read the fstab when you invoke: umount /mount/point. But I repeat, may I misunderstanding the process of umount, the mount I'm sure is gonna to work like I had describe.
– AtomiX84
yesterday
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
Up to down? You mean bottom up or top down???
– FreeSoftwareServers
21 hours ago
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2faskubuntu.com%2fquestions%2f1106879%2fdoes-order-of-mount-operations-matter-when-mounting-into-an-existing-mountpoint%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