Home Directories over NFS
Something simple that turned out to be PITA at first.
This took me a while to figure out, and i couldn't find much on the net, hence my notes here.
Overview
I have a FreeBSD file server and Kubuntu Linux for my workstations. I wanted to be able to log into any workstation and access my files. Not an unreasonable request.
The problem i kept running into at first, was that KDE wouldn't come up when mounted over NFS. After seeing a couple of bug reports, i thought this to be a bug in KDE. So i tried running GNOME instead. Same problem. It wouldn't start. I had this working in the past when i ran KDE 3.2 from a FreeBSD client to a FreeBSD server.
It turned out that i wasn't running lockd on the server. So i enabled lockd on the server, and much to my joy both KDE and GNOME came up. Great problem solved.
Not so fast. I noticed that occasionally more often than not apps would take up to minute to start without significant load of any type. After cheking the usual suspects like DNS, i ended up using a packet sniffer (Wireshark) and started looking requests that weren't being answered in time. This took me a while, as there was tons of other stuff on the wire. After turning off browsers, email clients etc. I managed to isolate the network traffic related to trying to open an app.
It turned out that the lock daemon on FreeBSD was having issues. I never did figure out the issues. After looking at the man page for mount on Linux i noticed the nolock option in the nfs section. After specifying this things worked like a charm.
Below is the config i used.
FreeBSD Server Config (192.168.1.1)
The directories /data/roamers/ holds the user's home directories.
- /etc/rc.conf
rpcbind_enable="YES" nfs_server_enable="YES" mountd_enable="YES" mountd_flags="-r" rpc_lockd_enable="YES" rpc_statd_enable="YES"
I don't think the rpc_lockd_enable is needed anymore, but i left it anyway.
- /etc/exports
/data/roamers -maproot=0 -alldirs -network 192.168.1.0 -mask 255.255.255.0
Kubuntu Client Config (192.168.1.x)
I run autofs to mount the nfs share. It deals fairly well with coming back from hibernation.
- /etc/auto.master
/.amd /etc/auto.misc
- /etc/auto.misc
roamers -fstype=nfs,rw,hard,intr,rsize=8192,wsize=8192,nfsvers=3,nolock 192.168.1.1:/data/roamers
- my ls -l /home gives me the following
lrwxrwxrwx 1 root root 19 2007-10-27 20:35 user1 -> /.amd/roamers/user1 lrwxrwxrwx 1 root root 18 2007-10-27 21:01 user2 -> /.amd/roamers/user2
Every home directory is a symlink to the autofs mounted directory. I don't like putting the mount point directly on the home directory because if the share doesn't come up for some reason, the directory will be treated as a regular directory and config files will be written to making subsequent mounts impossible unless cleared out again.