# autofs only mounting remote /



## smillions (Aug 14, 2018)

I have just upgraded my first system to 11.x (11.2) and autofs is giving me grief. I've been using amd to this point with no problems and I had hoped that replacing `amd_enable="YES"` with `autofs_enable="YES"` would be all that was required. But only the remote / is being mounted and for the life of me I can't figure out why. I'm using the default autofs configuration and the -hosts map.

showmount says the filesystems are exported on the server

```
$ showmount -E server
/var/hd-images
/var/db
/var
/tmp
/home
/exports
/
$
```

But when I try to access the /home (or any other file system) it doesn't mount.


```
$ ls /net/server/home/bob
ls: /net/server/home/bob: No such file or directory
$
```

/ is mounted, but that is all

```
$ mount -t nfs
server:/ on /net/server (nfs, nosuid, automounted)
$
```

I can mount the filesystem manually, so I don't think it is an NFS configuration issue

```
$ sudo mount server:/ /mnt
$ sudo mount server:/home /mnt/home
$ ls -d /mnt/home/bob
/mnt/home/bob
$
```

Any insights appreciated, 'cause I'm stumped.


----------



## k.jacker (Aug 14, 2018)

The way you created your export list, you can only export / together with the other directories when they are all on separate filesystems.
Further, by the nature of autofs, using the special map *-hosts* won't work in your case.

Directories in /net/_server/mountpoint/..._are automatically created on the client matching the exported remote path.
Thus I doubt you can mount a remote path named / here. The content of / (/net/server/(root here)) would disappear the moment you mount /home (or anything else) on it, because it would be created as /net/server/home/.

It should work using direct maps, but I would rather rethink your concept of exporting / at all.


----------



## smillions (Aug 14, 2018)

k.jacker said:


> The way you created your export list, you can only export / together with the other directories when they are all on separate filesystems.


Each of those exports is a separate filesystem.


> Further, by the nature of autofs, using the special map *-hosts* won't work in your case.
> 
> Directories in /net/_server/mountpoint/..._are automatically created on the client matching the exported remote path.
> Thus I doubt you can mount a remote path named / here. The content of / (/net/server/(root here)) would disappear the moment you mount /home (or anything else) on it, because it would be created as /net/server/home/.


I removed / from my export list and indeed autofs mounted /home as /net/server/home. So I tried accessing /net/server/var/db; autofs mounted /var as /net/server/var but didn't mount /var/db. Am I to understand that autofs doesn't mount child filesystems?


> It should work using direct maps, but I would rather rethink your concept of exporting / at all.


I've been working like this for about 20 years, I'm kind of used to it. I think I will just revert to amd which works the way I expect.


----------



## k.jacker (Aug 15, 2018)

I can't see that mounting a child filesystem like your /net/server/var and /net/server/var/db will work with the *-hosts* map.

You could use a direct map instead like I do:
/etc/auto_master

```
/-        auto_nfs
```


Create /etc/auto_nfs

```
/nfs/hd-images        server:/var/hd-images
/nfs/db               server:/var/db   
/nfs/var              server:/var 
/nfs/tmp              server:/tmp
/nfs/home             server:/home
/nfs/exports          server:/exports
```


Create the folders /nfs/hd-images, /nfs/db, etc...


----------



## smillions (Aug 15, 2018)

I find it bizarre that autofs can't maintain the directory hierarchy, if I have to flatten the directory tree it looses its appeal to me. Thanks for your explanation. I had assumed that autofs would provide equivalent functionality to amd and thought I must be doing something wrong. I just had false expectations based on a faulty assumption.


----------

