# exportfs weirdness



## bnorton916 (Sep 14, 2013)

I will apologize in advance if there is another thread that talks about this. I did look.

This is on a play network using VirtualBox to run two instances of FreeBSD 9.


```
masterfs:/root#cat /etc/exports
/work 192.168.1.40 192.168.1.41 192.168.1.42
/work2 192.168.1.40 192.168.1.41 192.168.1.42
```

clientfs (.42) can mount /work fine.  /work2 it can't mount.

If I remove the /work entry it can then mount /work fine.  If I switch the order it can mount /work2 but not /work.

`mountd` on the server gives this error:

```
can't change attributes for /work2
```

I found this which describes actually what is going on;

```
bin/109911: mountd(8) does not accept identical host sets on different mount entries on the same file system
```

:\ I just reread the bug message, and I figured out my problem. My /etc/exports should read like so:

```
/work /work2 192.168.1.40 192.168.1.41 192.168.1.42
```

Everything now seems to work fine.

I'm going to post this just in case someone else has similar problem. :r

Bill


----------



## PugTsurani (Nov 16, 2013)

First I want to thank you @bnorton916 for finding the root cause of a problem that has been plaguing me for some time. I want to elaborate on "same file system" with respect to ZFS. Normally, a file system is usually defined as the same mount point. You format a drive with a given file system and them mount it. With ZFS, file systems are defined with zfs(8), not zpool(8). Some examples might make this clearer.

My backup zpool has only one ZFS file system.

```
# zfs list | grep '^backup'
backup                                    1.15T  6.48T  1.06T  /backup
```
Therefore, all exports need to use the same entry. Backslashes are used for readability and supported by exports(5).

```
/backup/mm \
/backup/XenServer/ISO \
/backup/XenServer/vm \
    -mapall=root \
    -network 192.168.1.0/24 \
    -sec=sys:krb5:krb5i:krb5p
```

I have another zpool that has many ZFS file systems for finer control. 

```
# zfs list | grep -E '^datastore/(mm|mycloud)'
datastore/mm                               133G  4.21G   131G  /datastore/mm
datastore/mycloud                         55.3G  4.21G  25.8G  /datastore/mycloud
datastore/mycloud/CloudUser                     29.5G  4.21G  2.73G  /datastore/mycloud/CloudUser
datastore/mycloud/CloudUser/files               26.5G  4.21G  16.2G  /datastore/mycloud/CloudUser/files
```
Since these are separate file systems, I need a separate entries.

```
/datastore/mm \
    -mapall=root \
    -network 192.168.1.0/24 \
    -sec=sys:krb5:krb5i:krb5p

/datastore/mycloud/CloudUser/files \
    -mapall=root \
    -network 192.168.1.0/24 \
    -sec=sys:krb5:krb5i:krb5p
```

Reading the exports(5) man page one last time I found this behavior is explained in the *BUGS* section.

```
BUGS
     The export options are tied to the local mount points in the kernel and
     must be non-contradictory for any exported subdirectory of the local
     server mount point.  It is recommended that all exported directories
     within the same server file system be specified on adjacent lines going
     down the tree.  You cannot specify a hostname that is also the name of a
     netgroup.  Specifying the full domain specification for a hostname can
     normally circumvent the problem.
```


----------

