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?

3
  • 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 Jan 17, 2019 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 ? Jan 18, 2019 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. Jan 18, 2019 at 22:07

2 Answers 2

4

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

2
  • 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 ? Jan 18, 2019 at 21:29
  • using /mnt/source_dir /home/user/desitnation_dir none bind worked for me otherwise it gives error of unknown file type 'bind'
    – R T
    Sep 16, 2022 at 20:36
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

2
  • 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 Jan 18, 2019 at 22:47
  • Thank you for mentioning that Sergiy. I will keep that in mind. Thank you. Jan 18, 2019 at 23:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .