1

I have mounted nfs volume in my /etc/fstab as

nfshost.com:/path/dir  /mount/point  nfs     rw,sync,hard,intr       0       0

I'd like to mount another nfs volume

nfshost.com:/completely/different/path  /mount/point/subdirectory  nfs     rw,sync,hard,intr       0       0

However, it doesn't seem to work, I get the error message

mount.nfs: mount point /mount/point/subdirectory does not exist

I also can't mount it manually with sudo mount nfshost.com:/completely/different/path /mount/point/subdirectory. Mounting it anywhere else, e.g. sudo mount nfshost.com:/completely/different/path /tmp/test works.

I suspect that the problems are that I neither have write access to the originally mounted /path/dir, nor does it have the subdirectory to which I'd mount the other volume. Creating the directory structure /mount/point/subdirectory locally, mounting first into subdirectory then into mount/point works, but then mount/point contains the mounted volume and I can't access subdirectory.

ls /mount/point/subdirectory
ls: cannot access '/mount/point/subdirectory': No such file or directory

Is there a way to mount these volumes to achieve this directory structure?

  • have you tried using bind option ? Like this sudo mount -o bind nfshost.com:/completely/different/path /mount/point/subdirectory – Rahul Aug 4 '17 at 6:48
  • @Rahul: mount: mount point /mount/point/subdirectory does not exist – ytg Aug 4 '17 at 7:07
  • you'll need root accces on /mount/point, either local (if exported with access/root) or on nfshost.com to issue mkdir /mount/point/subdirectory – Archemar Aug 4 '17 at 13:49
1

You need to create the directory first.

mount doesn't create a mount point if it doesn't exist. That's why it's telling you mount point /mount/point/subdirectory does not exist

Try:

sudo mkdir /mount/point/subdirectory
sudo mount nfshost.com:/completely/different/path /mount/point/subdirectory

If you don't have write access to /mount/point/ then you can't create a directory in it. You'll have to mount the second directory somewhere else.

  • "Creating the directory structure /mount/point/subdirectory locally, mounting first into subdirectory then into mount/point works, but then mount/point contains the mounted volume and I can't access subdirectory." – ytg Aug 4 '17 at 7:04
  • yes, that's because you mounted the nfs share over the local directory, i.e. replaced it. you need write access to /mount/point/ after the nfs share has been mounted. – cas Aug 4 '17 at 7:14
  • 1
    I have a feeling that I didn't completely replace it, as I can still sudo umount /mount/point/subdirectory successfully, I'm just unable to access it in any other way... – ytg Aug 4 '17 at 7:24
  • no, it didn't "completely replace it". the directory and its contents aren't deleted, you just can't get at them easily while something else is mounted over the directory. – cas Aug 4 '17 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.