2

I'd like to use autofs to mount two directories from my laptop to my lan-server. The problem is, that autofs mounts one directory but not the other...

This is how my laptop exports the directories:

/etc/exports

/home           192.168.178.10(ro,sync,fsid=0,crossmnt,no_subtree_check,root_squash)
/home/peter      192.168.178.10(ro,sync,no_subtree_check,root_squash)
/media/peter/vm             192.168.178.10(ro,sync,fsid=1,no_subtree_check,root_squash)
/media/peter/vm/Windows_7_x64      192.168.178.10(ro,sync,no_subtree_check,root_squash)

The server shows me the exports like expected:

$ showmount -e peter-laptop

Export list for peter-laptop:
/media/peter/vm/Windows_7_x64 192.168.178.10
/media/peter/vm               192.168.178.10
/home/peter                   192.168.178.10
/home                         192.168.178.10

I can mount the NFS shares manually and it works fine:

 $ sudo mount peter-laptop:/home /home/peter/test_home/
 $ sudo mount peter-laptop:/media/peter/vm /home/peter/test_vm/

Now I unmount everything and try to mount again with autofs:

On the server I have this in /etc/autofs.master :

/import/peter-laptop/peter     /etc/auto.peter-laptop --ghost

And this in /etc/autofs.peter-laptop :

home -fstype=nfs4,ro,retry=0,rsize=8192,wsize=8192,tcp 192.168.178.20:/peter
vm -fstype=nfs4,ro,retry=0,rsize=12288,wsize=12288,tcp 192.168.178.20:/media/peter/vm

If I restart autofs I get one dir for each mount:

/imports/peter-laptop/peter/home
/imports/peter-laptop/peter/vm

Everything works fine for the home dir, but if I cd into vm I get this error:

$ cd vm/
-bash: cd: vm/: No such file or directory

Any idea what I could do?

  • I would note that you seem to be doing 4 times the necessary amount of work here, assuming you only want to mount /home and all of it's subdirectories. – Thomas N Aug 19 '16 at 15:00
  • I want to mount /home/peter and /media/peter/vm/Windows_7_x64 and subdirs of both. – Rotareti Aug 19 '16 at 18:07

Your Answer

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

Browse other questions tagged or ask your own question.