FreeBSD ZFS Filesystem strange behaviour with NFS

Hi,

I have copied yesterday all my data over nfs from my old Gentoo server on the new FreeBSD server. All homedirs are now on the ZFS storage mounted on NFS.

Now I started the NFS Server on the FreeBSD machine and wanted to mount on my Linux clients (Archlinux).

Here I am getting following error message:
Code:
mount -t nfs 192.168.178.4:/home /mnt -v
mount.nfs: timeout set for Sun Jul  3 18:47:46 2011
mount.nfs: trying text-based options 'vers=4,addr=192.168.178.4,clientaddr=192.168.178.20'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=192.168.178.4'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.178.4 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.178.4 prog 100005 vers 3 prot UDP port 922
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.178.4:/home

Code:
freebsd# cat /etc/exports
#The following examples export /usr to 3 machines named after ducks,
#/usr/src and /usr/obj read-only to machines named after trouble makers,
#/home and all directories under it to machines named after dead rock stars
#and, /a to a network of privileged machines allowed to write on it as root.
# You should replace these lines with your actual exported filesystems.
# Note that BSD's export syntax is 'host-centric' vs. Sun's 'FS-centric' one.
/home	 -alldirs	192.168.178.20

See more in the last post.

Regards, bsus
 
Seems there is an issue with ZFS.

I now tried:
[cmd=]zfs set sharenfs="rw,192.168.178.20" storage/home[/cmd]

Code:
cat /etc/zfs/exports
 cat /etc/zfs/exports
# !!! DO NOT EDIT THIS FILE MANUALLY !!!

/storage	no 
/home	rw 192.168.178.20

But when I want to mount from 192.168.178.20 I am still getting the same error. Mounting other directories from the server works without problems and connecting over Samba to the ZFS is also working well.

Why is ZFS and NFS so strange?

Regards
 
Hi,

Firstly, personally I'd setup the shares manually in /etc/exports rather than use the zfs commands. Secondly, I doubt your problem has anything to do with ZFS. What are the permissions on /home? Also if you want to prove to yourself the problem is not specifically related to ZFS try sharing a UFS file system and see if you get the same error,

thanks Andy.
 
Code:
ls -l /home
lrwxr-xr-x  1 root  wheel  8 Jul  2 01:55 /home -> usr/home

Code:
ls -l /usr/home
total 9
drwxr-xr-x   4 <user1>   users  15 Jan  9 20:02 <user1>
drwxr-xr-x  41 <user2>    users  50 Jan  9 09:16 <user2>
drwxr-xr-x  28 <user3>  users  37 Jan  9 19:54 <user3>

I tried to share ZFS over /etc/exports already. This didn't work
Code:
bad export line /home
even if the /home line was commented out, so I tried to use the zfs share command.

NFS properly serves other directories like /tmp. I think the problem lies with /home, which is just a symlink to /usr/home but also the mountpoint of the zfs.

Regards.
 
Code:
/usr/home -alldirs 192.168.178.20

solved the problem in a way but there are still issues.

I can mount the share now succesfully on clients but:

1. The server terminal says still:
Code:
bad line in exports

2. I don't have the right permissions. - I wanted to log on over GDM but it freezes on Linux servers. I had to fix this with /etc/idmapd.conf but there's none in /etc on FreeBSD.

3. I just can mount manually. By adding the nfs share to /etc/fstab on the client I am getting a timeout.

Next to these problems is it maybe better to mount the zfs storage under /usr/home instead of /home?

Thanks for the great help and regards, bsus
 
From the original post it seems your Linux client is trying NFSv4 first and then falling back to NFSv3. If you want to use NFSv4 then have a read of the man page nfsv4(4) as you need to add some extra bits to /etc/rc.conf and also use different syntax in /etc/exports. If you are happy to use NFSv3 then maybe you can configure the Linux client not to try NFSv4 which may help things.

Andy.
 
When enabling NFSv4 via the kernel my zfs filesystem doesn't mount properly anymore either. I am not sure if using a other version is the right way.

So my issue is: when I mount manually the "freebsd-zfs-nfs /home partition" to /home and then log on via gdm3 I only see the default desktop background - normally gnome wants to create .*-files where the settings are saved in and because of a permission problem it isn't allowed to create/edit them, so it hangs at this point.

I had this already before using NFS. I managed the issue by giving client and server the same domain (in /etc/idmapd.conf) but this is just quite different in FreeBSD and when I am honest I don't have any idea what's really going wrong now.

I only know that the desktop environment hangs by loading, creating, editing (?) any configuration files of the /home directory.

Regards
 
The ZFS "sharenfs" property tends to be a bit finicky. I haven't managed to get it to accept multiple network entries. This seems to work though:

Code:
dice@molly:~>zfs get sharenfs tank/FreeBSD/ports
NAME                PROPERTY  VALUE                                    SOURCE
tank/FreeBSD/ports  sharenfs  ro,maproot=0,network=2001:888:1c5b::/64  local
dice@molly:~>

Make sure it's either in /etc/exports or use the "sharenfs" property, not both.

Trying to add an IPv4 network to the existing IPv6 network restriction always seems to fail. It seems it only likes one of them.
 
Hi,

Until our ISP supports native IPv6 we will use IPv4 mainly. I think I will use the /etc/exports to share, sharenfs and nfs isn't as comfortable as it should be. So, again to my issue. It is a very special permission problem which only disturbs producty by using desktop environments with multiple configuration files.

Could it be that the problem is that gnome/xorg want to write .* files as root in my /home directory and I only have full access with the user - root only has read access to /home - does this sound logical?

Regards
 
bsus said:
Could it be that the problem is that gnome/xorg want to write .* files as root in my /home dir and I only have full access with the user - root only has read access to /home - does this sound logical?
Try using the option -maproot=root in /etc/exports. You may want to contemplate the security ramifications involved, but if it works at least you now know where the problem is/was.

Fonz
 
Didn't help :(

I had also problems mounting over fstab and I saw on the server display that there's still a
Code:
bad export line

Aren't there more people sharing /home and having some issues at the beginning?

Regards.
 
I found now what solves the issue:
Code:
echo 'rpc_lockd_enable="YES"
rpc_statd_enable="YES"' >> /etc/rc.conf && reboot

Now gnome is loading properly! Thanks for your help.

Regards.
 
So I'm back with another issue. When I copy for example a video on my local drive from the nfs /home share I only get 40-45MB/s. On the Samba share there's a good 90-110MB/s.

How can I tune ZFS and NFS a little bit to give more performance?
 
bsus said:
Code:
echo 'rpc_lockd_enable="YES"
rpc_statd_enable="YES"' >> /etc/rc.conf && reboot
<smacks forehead>
Sigh... that's so easy to forget :\

Anyway, I'm glad to hear that you have it working now. As for the performance issue, maybe you should start a new thread for that. Unfortunately I don't know much about ZFS, so I can't really help you there.

Good luck,

Fonz
 
Back
Top