Installation of NFS

From ImageWiki

Jump to: navigation, search

This page describes how I installed and configured NFS on both the file servers and the IBM blade machines (clients in NFS terms). I basically followed the HOWTO at: HOWTO Share Directories via NFS


Contents

Installation setup

Start by making sure that on all machines the /etc/hosts file includes all other machines.

# /etc/hosts
192.168.10.101 imagediskserver1
192.168.10.102 imagediskserver2
192.168.10.103 imagediskserver3
192.168.10.111 imageserver1
192.168.10.112 imageserver2
192.168.10.113 imageserver3


NFS file server installation (imagediskserver1-3):

Make sure NFSv3 support is compiled into the kernel. Check by cd /usr/src/linux && make menuconfig


Emerge NFS:

emerge nfs-utils


Create mount points for NFS directories:

mkdir /image
mkdir /image/data1
mkdir /image/data2
mkdir /image/data3
mkdir /image/scratch1
mkdir /image/scratch2


Modify EXPORTS:
Change the file /etc/exports to:

imagediskserver1:

# /etc/exports: NFS file systems being exported.  See exports(5).
/image/data1 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)
/home 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)

imagediskserver2:

# /etc/exports: NFS file systems being exported.  See exports(5).
/image/data2 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)
/image/scratch1 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)

imagediskserver3:

# /etc/exports: NFS file systems being exported.  See exports(5).
/image/data3 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)
/image/scratch2 192.168.10.0/255.255.255.0(async,no_subtree_check,no_root_squash,rw)


Run the following commands to start NFS daemon and set its run level:

/etc/init.d/portmap start && /etc/init.d/nfs start && rc-update add nfs default
rc-update add portmap default

Check it works with:

rc-update show

If you make changes to /etc/exports after this you should run:

exportfs -ra && /etc/init.d/nfs reload

We also want to make the user directories available on the disk servers so add the following lines to /etc/fstab:
imagediskserver1:

imagediskserver2:/image/data2 /image/data2/        nfs     rw,hard,intr    0 0
imagediskserver2:/image/scratch1 /image/scratch1/  nfs     rw,hard,intr    0 0
imagediskserver3:/image/data3 /image/data3/        nfs     rw,hard,intr    0 0
imagediskserver3:/image/scratch2 /image/scratch2/  nfs     rw,hard,intr    0 0

imagediskserver2:

imagediskserver1:/image/data1 /image/data1/        nfs     rw,hard,intr    0 0
imagediskserver1:/home /home                       nfs     rw,hard,intr    0 0
imagediskserver3:/image/data3 /image/data3/        nfs     rw,hard,intr    0 0
imagediskserver3:/image/scratch2 /image/scratch2/  nfs     rw,hard,intr    0 0

imagediskserver3:

imagediskserver1:/image/data1 /image/data1/        nfs     rw,hard,intr    0 0
imagediskserver1:/home /home                       nfs     rw,hard,intr    0 0
imagediskserver2:/image/data2 /image/data2/        nfs     rw,hard,intr    0 0
imagediskserver2:/image/scratch1 /image/scratch1/  nfs     rw,hard,intr    0 0


Finish by running:

rc-update add nfsmount default

Try to reboot and check that everything works as it should.

NFS client installation (imageserver1-3):

Make sure NFSv3 support is compiled into the kernel. Check cd /usr/src/linux && make menuconfig

Emerge NFS:

emerge nfs-utils

Issue the following commands:

/etc/init.d/portmap start
rc-update add portmap default

Create mount points for NFS directories:

mkdir /image
mkdir /image/data1
mkdir /image/data2
mkdir /image/data3
mkdir /image/scratch1
mkdir /image/scratch2


Check it works:

mount imagediskserver2:/image/data2 /image/data2/

and run: mount
Do you see the mount point in the list?


Now to make the disk automount after reboot make the following changes to /etc/fstab:

imagediskserver1:/image/data1 /image/data1/        nfs     rw,hard,intr    0 0
imagediskserver1:/home /home                       nfs     rw,hard,intr    0 0
imagediskserver2:/image/data2 /image/data2/        nfs     rw,hard,intr    0 0
imagediskserver2:/image/scratch1 /image/scratch1/  nfs     rw,hard,intr    0 0
imagediskserver3:/image/data3 /image/data3/        nfs     rw,hard,intr    0 0
imagediskserver3:/image/scratch2 /image/scratch2/  nfs     rw,hard,intr    0 0


Finish by running:

rc-update add nfsmount default


Try to reboot and check that everything works as it should.

Tweaking the performance

The performance tweaking of NFS is based on NFS Howto and especially the section on optimizing NFS performance.

Personal tools