0

I'd like to mount two nfs folder on local linux machine (nfs4)

Is it okay to mount as following? (note 2nd mount point is overlapped with the 1st mount)

# /etc/fstab
svr1:/folder1 /mnt nfs ...
svr2:/folder2 /mnt/share nfs ...

Mount points are created on local disk before mounting(/mnt, /mnt/share)

It looks okay when I tried, but I'like to know if there might be problems later. Do I have to take care in the order of mount?


EDIT: My mistake.

local:/mnt/share has been hidden by mounting svr1:/folder1 on /mnt.

svr2:/folder2 has been mounted on /mnt/share which is actually svr1:/folder1/share.

As long as svr1:/folder1/share is empty, is this setup good enough? Or it will bring mess someday?

4
  • I can assure svr1:/folder1/share won't be created. My concern is /mnt is not empty while mounting svr1:/folder1. The goal is to maintain compatibility. /folder1/share has become too large for the disk, hence separated to another disk of different server.
    – auditory
    Feb 7, 2022 at 8:47
  • 1
    If /mnt is not empty before the NFS mount, the contents will be hidden. This includes the directory /mnt/share which will need to exist on svr1:/folder1.
    – doneal24
    Feb 7, 2022 at 13:14
  • @doneal24 that is exactly what I concerned. And you are right. local:/mnt/share is hidden by mount svr:/folder1 on /mnt and actually svr2:/folder2 was mounted on /mnt/share which is actually svr:/folder1/share (that is empty). Is this setup okay then?
    – auditory
    Feb 7, 2022 at 13:29
  • 1
    This setup should work. You might consider @pLumo's suggestion about not using /mnt directly as this might simply expanding things in the future.
    – doneal24
    Feb 7, 2022 at 13:52

1 Answer 1

1

Having mountpoints below other mountpoints is just the normal setup. Compare / is also just a mountpoint with /mnt below.

If you created srv1:/folder1/share and have files inside, you will have issues mounting srv2:/folder2 (moint point not empty).

I would put my mountpoints below /mnt and not use /mnt, but technically speaking it it is not a problem.

2
  • The reason not using /mnt is /mnt is the top most dir or /mnt is general mount point? I am using different name, say /svr instead of /mnt and /mnt was just an example. Thank you for the answer.
    – auditory
    Feb 8, 2022 at 0:26
  • /mnt is not a mountpoint. It's the dir to have the mountpoints below. What if you have multiple mountpoints, what is /mnt, where do you put the others ? For me, that would make a strange hierarchy.
    – pLumo
    Feb 8, 2022 at 7:23

You must log in to answer this question.

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