NFSv4 between Linux and Solaris

Posted by Dick on October 07, 2007

Openoffice on Ubuntu had been pissing me off no end – hanging on startup, etc.
Google pointed the finger at NFSv3
(which is how I share out a ZFS home directory from my Solaris box ).
Apparently it’s happier on NFSv4
(setantae describes it as ‘NFS without the shitty bits), so it’s time to revisit that.

the Solaris end

Solaris 10 (and up) defaults to NFS4, so the only things to do are:

  1. check your NFSv4 domain (== your DNS domain, unless you changed it)
  2. backup the homedir in case linux goes batshit and eats all your por^W mission-critical data
   zfs snapshot tank/home/username@pre-nfsv4

the linux end

sudo apt-get install nfs-common
echo 'NEED_IDMAPD=yes' >> /etc/default/nfs-common

there’s no home for you here

When I remounted my home directory all hell broke loose.
Ubuntu defaults to an NFS domain of ‘localhost’ for some reason.
The mismatch means NFS can’t tell who you are, so it punts and all your files
are suddenly owned by nobody:nobody. You can’t login.

No harm done (so long as you have another account :) ):

echo 'Domain = yourdomain.com' >> /etc/idmapd.conf
sudo /etc/init.d/nfs-common restart

then remount your shares. Everything should look ok now. OO works, at least.

ZIL communication

Posted by Dick on February 12, 2007

If you’re dealing with lots of small files, a
NFS and ZFS combination
can run slower than you’d like.

For example, untarring the apache source tree on the NFS client:

planb:$ time tar xvf httpd-2.2.4.tar.gz
real    2m9.594s
user    0m0.356s
sys     0m0.508s

Ouch.

BenR mentioned turning off the ZIL
(ZFS intent log ) to speed up ZFS+NFS over aggregated Gbit ethernet – I doubted my 100Mbit link would have the same bottleneck for anything,
but it was worth a go.

Tell the ZFS/NFS server to switch off the ZIL:

vera# echo 'set zfs:zil_disable=1' >> /etc/system

Then either reboot, or run:

vera # echo ‘zil_disable/W 1’ | mdb -kw
vera # zpool export tank
vera # zpool import tank

In my case, I might as well reboot.

planb:$ mv httpd-2.2.4 outoftheway
planb:$ time tar xzf httpd-2.2.4.tar.gz
real    0m4.862s
user    0m0.368s
sys     0m0.440s

Holy crap.

There are some
implications to the ‘correctness’ of this from the NFS clients point of view but on the ZFS box itself it’s non-lethal, so I think
I’ll keep it (I’m snapshotting the share three times a day, so I’m
reasonably safe if when Linux shits itself).