How to mount a specific directory from a partition(not the entire partition) onto mount point (say /home)?












0















here is what i want to do:



I used to have only one distro installed, so i had a fstab entry like:



UUID=dccfc257-7039-4dba-9a2f-469f6bbc5fbf  /home  ext4  nodev,nosuid    0   2


now I installed another distro, and i want to mount a specific directory of that same partition to my /home in the new distro such as:



[that_partition]/CentosHome/username/whatever  <--- this kind of thing, for example
[that_partition]/UbuntuHome/username/whatever


How do i achieve this? How to use UUID for this? (since the sdX format names are subject to changes
what commands do i need?










share|improve this question




















  • 1





    Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

    – Sergiy Kolodyazhnyy
    Jan 17 at 23:04











  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29











  • Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:07











  • yea, i got that. Thank you, Sergiy.

    – Mahmoud Gudarzi
    Jan 18 at 22:11
















0















here is what i want to do:



I used to have only one distro installed, so i had a fstab entry like:



UUID=dccfc257-7039-4dba-9a2f-469f6bbc5fbf  /home  ext4  nodev,nosuid    0   2


now I installed another distro, and i want to mount a specific directory of that same partition to my /home in the new distro such as:



[that_partition]/CentosHome/username/whatever  <--- this kind of thing, for example
[that_partition]/UbuntuHome/username/whatever


How do i achieve this? How to use UUID for this? (since the sdX format names are subject to changes
what commands do i need?










share|improve this question




















  • 1





    Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

    – Sergiy Kolodyazhnyy
    Jan 17 at 23:04











  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29











  • Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:07











  • yea, i got that. Thank you, Sergiy.

    – Mahmoud Gudarzi
    Jan 18 at 22:11














0












0








0








here is what i want to do:



I used to have only one distro installed, so i had a fstab entry like:



UUID=dccfc257-7039-4dba-9a2f-469f6bbc5fbf  /home  ext4  nodev,nosuid    0   2


now I installed another distro, and i want to mount a specific directory of that same partition to my /home in the new distro such as:



[that_partition]/CentosHome/username/whatever  <--- this kind of thing, for example
[that_partition]/UbuntuHome/username/whatever


How do i achieve this? How to use UUID for this? (since the sdX format names are subject to changes
what commands do i need?










share|improve this question
















here is what i want to do:



I used to have only one distro installed, so i had a fstab entry like:



UUID=dccfc257-7039-4dba-9a2f-469f6bbc5fbf  /home  ext4  nodev,nosuid    0   2


now I installed another distro, and i want to mount a specific directory of that same partition to my /home in the new distro such as:



[that_partition]/CentosHome/username/whatever  <--- this kind of thing, for example
[that_partition]/UbuntuHome/username/whatever


How do i achieve this? How to use UUID for this? (since the sdX format names are subject to changes
what commands do i need?







dual-boot mount fstab mountpoint






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 23:46







Mahmoud Gudarzi

















asked Jan 17 at 22:33









Mahmoud GudarziMahmoud Gudarzi

58117




58117








  • 1





    Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

    – Sergiy Kolodyazhnyy
    Jan 17 at 23:04











  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29











  • Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:07











  • yea, i got that. Thank you, Sergiy.

    – Mahmoud Gudarzi
    Jan 18 at 22:11














  • 1





    Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

    – Sergiy Kolodyazhnyy
    Jan 17 at 23:04











  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29











  • Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:07











  • yea, i got that. Thank you, Sergiy.

    – Mahmoud Gudarzi
    Jan 18 at 22:11








1




1





Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

– Sergiy Kolodyazhnyy
Jan 17 at 23:04





Mount is for filesystems. A directory is only one part of filesystem, so you cannot select just part of a filesystem to mount. But you could mount /CentosHome/username/whatever at /media/username/centos and then make a symbolic link to /media/username/centos/username/whatever inside your home folder. That's what I do with my VirtualBox machines. I've symbolic link to the directory , but filesystem is mounted at /media/myuser/second_hard_drive

– Sergiy Kolodyazhnyy
Jan 17 at 23:04













Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

– Mahmoud Gudarzi
Jan 18 at 21:29





Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

– Mahmoud Gudarzi
Jan 18 at 21:29













Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

– Sergiy Kolodyazhnyy
Jan 18 at 22:07





Looks alright. Remember that you need same usernames on both systems to have access rights for each respective owner of the directory.

– Sergiy Kolodyazhnyy
Jan 18 at 22:07













yea, i got that. Thank you, Sergiy.

– Mahmoud Gudarzi
Jan 18 at 22:11





yea, i got that. Thank you, Sergiy.

– Mahmoud Gudarzi
Jan 18 at 22:11










2 Answers
2






active

oldest

votes


















3














You cannot mount directly a specific directory. You have to mount the entire partition then bind the directory. see bind mount in man mount



First you make an entry in /etc/fstab to mount your old drive:



[that partition] /mnt/[that partition] auto nosuid,nodev,nofail, 0 0



then you bind the directory you want (in fstab)



/mnt/[that partition][/that dir] /home/user/whatever bind






share|improve this answer


























  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29



















1














Here's what i did , it seems like i have my home working. attached is a snap of my fstab. Comments are appreciated.



this is how my fstab looks now






share|improve this answer
























  • For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:47











  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

    – Mahmoud Gudarzi
    Jan 18 at 23:44













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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110684%2fhow-to-mount-a-specific-directory-from-a-partitionnot-the-entire-partition-ont%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You cannot mount directly a specific directory. You have to mount the entire partition then bind the directory. see bind mount in man mount



First you make an entry in /etc/fstab to mount your old drive:



[that partition] /mnt/[that partition] auto nosuid,nodev,nofail, 0 0



then you bind the directory you want (in fstab)



/mnt/[that partition][/that dir] /home/user/whatever bind






share|improve this answer


























  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29
















3














You cannot mount directly a specific directory. You have to mount the entire partition then bind the directory. see bind mount in man mount



First you make an entry in /etc/fstab to mount your old drive:



[that partition] /mnt/[that partition] auto nosuid,nodev,nofail, 0 0



then you bind the directory you want (in fstab)



/mnt/[that partition][/that dir] /home/user/whatever bind






share|improve this answer


























  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29














3












3








3







You cannot mount directly a specific directory. You have to mount the entire partition then bind the directory. see bind mount in man mount



First you make an entry in /etc/fstab to mount your old drive:



[that partition] /mnt/[that partition] auto nosuid,nodev,nofail, 0 0



then you bind the directory you want (in fstab)



/mnt/[that partition][/that dir] /home/user/whatever bind






share|improve this answer















You cannot mount directly a specific directory. You have to mount the entire partition then bind the directory. see bind mount in man mount



First you make an entry in /etc/fstab to mount your old drive:



[that partition] /mnt/[that partition] auto nosuid,nodev,nofail, 0 0



then you bind the directory you want (in fstab)



/mnt/[that partition][/that dir] /home/user/whatever bind







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 18 at 3:02

























answered Jan 18 at 1:51









Jean-MarieJean-Marie

1,084168




1,084168













  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29



















  • Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

    – Mahmoud Gudarzi
    Jan 18 at 21:29

















Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

– Mahmoud Gudarzi
Jan 18 at 21:29





Hello , thank you for you guidance, I think i was able to do it. i'm attaching a snap of my fstab here , would you please check it everything looks alright ?

– Mahmoud Gudarzi
Jan 18 at 21:29













1














Here's what i did , it seems like i have my home working. attached is a snap of my fstab. Comments are appreciated.



this is how my fstab looks now






share|improve this answer
























  • For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:47











  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

    – Mahmoud Gudarzi
    Jan 18 at 23:44


















1














Here's what i did , it seems like i have my home working. attached is a snap of my fstab. Comments are appreciated.



this is how my fstab looks now






share|improve this answer
























  • For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:47











  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

    – Mahmoud Gudarzi
    Jan 18 at 23:44
















1












1








1







Here's what i did , it seems like i have my home working. attached is a snap of my fstab. Comments are appreciated.



this is how my fstab looks now






share|improve this answer













Here's what i did , it seems like i have my home working. attached is a snap of my fstab. Comments are appreciated.



this is how my fstab looks now







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 18 at 21:33









Mahmoud GudarziMahmoud Gudarzi

58117




58117













  • For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:47











  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

    – Mahmoud Gudarzi
    Jan 18 at 23:44





















  • For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

    – Sergiy Kolodyazhnyy
    Jan 18 at 22:47











  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

    – Mahmoud Gudarzi
    Jan 18 at 23:44



















For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

– Sergiy Kolodyazhnyy
Jan 18 at 22:47





For future reference, it's best not to post images of text, especially scripts or config files. Other users cannot edit the errors easily, plus images can go missing if the host website such as imgur deletes the image or the website itself is down

– Sergiy Kolodyazhnyy
Jan 18 at 22:47













Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

– Mahmoud Gudarzi
Jan 18 at 23:44







Thank you for mentioning that Sergiy. I will keep that in mind. Thank you.

– Mahmoud Gudarzi
Jan 18 at 23:44




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110684%2fhow-to-mount-a-specific-directory-from-a-partitionnot-the-entire-partition-ont%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?