cluster:Nfs/3
Contents |
Nfs/3/server
Prepare
- Operating system
- Scientific Linux version 4.7 64 bit
Optimizing the configuration:
Use minimal operating system installation without firewall. To verify installed packages use the command
-
rpm -qa | grep package_name
Install the following additional packages:
-
yum -y install wget yum rpm make gcc gcc-c++ tar sed zlib openssl
After the installation is complete, turn off any unnecessary services (like gpm, sendmail, cups, haldaemon, messagebus, pcmcia, anacron, atd) with the following command:
-
chkconfig <SERVICE> off
Configure the following settings for the server:
| Prepare new hard disk
|
- Firewall configuration
- configure TCP port 2049 (how to open port in firewall).
administrator's script: prepare.sh
#!/bin/bash# prepare the nfs server installation# execute as root# echo `su -`# Declare the variables section ------------# Please insert your actual configuration# NFS_SERVER_DIR="export directory on nfs server"# HD_DEVICE="export device on nfs server"# RIGHTS="access mode for export directory on the nfs server"# Private network adresses# NETWORK=ip adress for private network# NETWORK_MASK=private network mask# from here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~NFS_SERVER_DIR="/srv/nfs"
HD_DEVICE="/dev/sdb1"
RIGHTS="1777"
NETWORK=10.0.171.0NETWORK_MASK=255.255.255.0# till here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#-> start routinemkdir -p ${NFS_SERVER_DIR}
chmod ${RIGHTS} ${NFS_SERVER_DIR}
#<- end routine
Install
Probably, the operating system has nfs service installed. To be sure, the following packages will be installed:
- nfs-utils
- portmap
- quota
administrator's script: install.sh
#!/bin/bash# install nfs server# execute as root# echo `su -`# load parameters from prepare sectioncd `dirname $0`
source prepare.sh#-> start routine# Verify that the following packets are not installed with the command:echo `rpm -qa | grep nfs-utils`
echo `rpm -qa | grep portmap`
echo `rpm -qa | grep quota`
yum -y install nfs-utils portmap quota
#<- end routine
Configure
The NFS server has to be configured to export filesets, like the users home directories, the system software (etc/profile.d, ogsadai), the VO specific software areas, the UNICORE filespace. Server in D-Grid reference installation exports only one directory, located into /srv/nfs with the following attributes:
| Export | Export options | Node | Mountpoint | Mount options | |
| nfs | /srv/nfs | rw,async | alle | /srv/nfs | nosuid |
Another requirements are to configure /etc/hosts.deny and /etc/hosts.allow configurations files. Add lines like the following (template: daemon_name: ALL):
cat /etc/hosts.deny portmap: ALL lockd: ALL statd: ALL mountd: ALL rquotad: ALL
In the file /etc/hosts.allow the lines for each of the five daemons:
- portmap
- lockd
- statd
- mountd
- rquotad
should look like this (template: daemon_name: ip.pc.client1, ip.pc.client2):
cat /etc/hosts.allow portmap: ip.pc.client1, ip.pc.client2 lockd: ip.pc.client1, ip.pc.client2 statd: ip.pc.client1, ip.pc.client2 mountd: ip.pc.client1, ip.pc.client2 rquotad: ip.pc.client1, ip.pc.client2
administrator's script: configure.sh
#!/bin/bash# configure the nfs server# load parameters from prepare sectioncd `dirname $0`
source prepare.sh#-> start routine# Edit the file /etc/exports adding the line:cat >>/etc/exports << EOF
/srv/nfs ${NETWORK}/${NETWORK_MASK}(rw,async,no_root_squash)
EOF
exportfs -a#<- end routine
Proceed
To run an NFS server, the portmap service must be running. To verify that portmap is active, type the following command as root:
service portmap status
- If the portmap service status is running, then
- the nfs service can be started with:
service nfs start - the nfslock service can be started with:
service nfslock start.
- the nfs service can be started with:
- Else execute:
service portmap startand after successful report,- the nfs service can be started with:
service nfs start - the nfslock service can be started with:
service nfslock start.
- the nfs service can be started with:
| By default, the nfs service does not start automatically at boot time. To configure the NFS to start up at boot time, use an initscript utility, such as /sbin/chkconfig, /sbin/ntsysv, or the Services Configuration Tool program.
|
administrator's script: proceed.sh
#!/bin/bash# proceed nfs#-> start routine# Start the services:/etc/init.d/portmap start
/etc/init.d/nfs start
/etc/init.d/nfslock start
# and add them to the start configuration with:chkconfig --level 35 portmap on
chkconfig --level 35 nfs on
chkconfig --level 35 nfslock on
# If the services are not present in the level management add them with "--add" chkconfig option.# Stop the services:/etc/init.d/portmap stop
/etc/init.d/nfs stop
/etc/init.d/nfslock stop
# alternative:/sbin/service nfs start
/sbin/service nfs stop
/sbin/service nfs restart
/sbin/service nfs condrestart
/sbin/service nfs reload
#<-end routine
Initial test
Verify that all necessary daemons are running. Use rpcinfo -p
# should be something like this: program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 719 status 100024 1 tcp 722 status 100011 1 udp 847 rquotad 100011 2 udp 847 rquotad 100011 1 tcp 850 rquotad 100011 2 tcp 850 rquotad 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100021 1 udp 32775 nlockmgr 100021 3 udp 32775 nlockmgr 100021 4 udp 32775 nlockmgr 100021 1 tcp 32789 nlockmgr 100021 3 tcp 32789 nlockmgr 100021 4 tcp 32789 nlockmgr 100005 1 udp 863 mountd 100005 1 tcp 866 mountd 100005 2 udp 863 mountd 100005 2 tcp 866 mountd 100005 3 udp 863 mountd 100005 3 tcp 866 mountd
administrator's script: test.sh
#!/bin/bash# initial tests for nfs server#-> start routinerpcinfo -p# Verify that the following packets are installed with the command:echo `rpm -qa | grep nfs-utils`
echo `rpm -qa | grep portmap`
echo `rpm -qa | grep quota`
#<- end routine
Update
There are some software managers (e.g. yum, yast) for operating systems which do the job well for update and new installation for packages. Please see the appropriate attributes for current task in the manuals for them (use man yum).
administrator's script: update.sh
#!/bin/bash# update#-> start routinesu -c 'yum update nfs-utils'
#<- end routine
Nfs/3/client
Prepare
NFS shares are mounted on the client side using the mount command. The format of the command is as follows:
mount -t <nfs-type> -o <options> <nfs_server_host>:</remote/export> </local/directory>
where <nfs-type> one from {nfs, nfs4}, <options> - a comma separated list of options for the NFS file system (refer to Common NFS Mount Options for details).
Reference installation use the singe mount point, hence </remote/export> and </local/directory> are /srv/nfs.
- Firewall configuration
- configure TCP port 2049 (how to open port in firewall).
administrator's script: prepare.sh
#!/bin/bash# prepare# execute as root# echo `su -`# Declare the variables section ------------# Please insert your actual configuration# NFS_PORT="Communication port for nfs service"# NFS_SERVER="adress for nfs server"# NFS_SERVER_DIR="export directory on nfs server"# NFS_MOUNT_DIR="mount directory on nfs client"# from here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~NFS_PORT="2049"
NFS_SERVER="dgiref-ifs1.fzk.de"
NFS_SERVER_DIR="/srv/nfs"
NFS_MOUNT_DIR="/srv/nfs"
# till here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Install
The Linux operating system offers two methods for mounting remote file systems:
- manually, with
mountservice (using a/etc/fstabconfiguration file) - automatically at boot time with the
autofsservice (using a main configuration file/etc/auto.masterand set ofauto.*files)
The reference installation use the first, manual method, hence the mount service should be installed. Probably, the operating system has nfs service installed. To be sure, the following packages can be additionally installed:
- nfs-utils
- portmap
- quota
administrator's script: install.sh
#!/bin/bash# install nfs client# execute as root# echo `su -`#-> start routineyum -y install mount
#<- end routine
Configure
With the daemons portmap, lockd, statd, mountd running NFS client should be able to mount the remote directory /srv/nfs and after creates the soft links to the mounted /srv/nfs subdirectories.
administrator's script: configure.sh
#!/bin/sh# configure the nfs client# load parameters from prepare sectioncd `dirname $0`
source prepare.sh#-> start routine# execute as root:# su -# check if the mount directory exists:[ -d "${NFS_MOUNT_DIR}" ] && echo "Directory ${NFS_MOUNT_DIR} exists" || echo `mkdir -p ${NFS_MOUNT_DIR}`
# If the mount command works add the mounting at the start-up editing the file /etc/fstab:echo "${NFS_SERVER}:${NFS_SERVER_DIR} ${NFS_MOUNT_DIR} nfs nfsvers=3,bg,hard,intr,nosuid,rsize=32768,wsize=32768,rw 0 0" >> /etc/fstab
mount -a
#<- end routine
Proceed
To communicate with an NFS server, the portmap service must be running. To verify that portmap is active, type the following command as root:
service portmap status
- If the portmap service status is running, then
- the nfs service can be started with:
service nfs start - the nfslock service can be started with:
service nfslock start - the mount service can be started with:
service nfslock start.
- the nfs service can be started with:
- Else execute:
service portmap startand after successful report,- the nfs service can be started with:
service nfs start - the nfslock service can be started with:
service nfslock start - the mount service can be started with:
service nfslock start.
- the nfs service can be started with:
| By default, the nfs service does not start automatically at boot time. To configure the NFS to start up at boot time, use an initscript utility, such as /sbin/chkconfig, /sbin/ntsysv, or the Services Configuration Tool program.
|
administrator's script: proceed.sh
#!/bin/bash# proceed#-> start routine# Start the services:/etc/init.d/portmap start
/etc/init.d/nfs start
/etc/init.d/nfslock start
# and add them to the start configuration with:chkconfig --level 35 portmap on
chkconfig --level 35 nfs on
chkconfig --level 35 nfslock on
# If the services are not present in the level management add them with "--add" chkconfig option.#<-end routine
Initial test
Lists the contents of the mounted directory with ls command.
WARNING: Possible troubles with mount
Problem 1
mount: sn05:/var/spool/pbs/server_logs failed, reason given by server: Permission denied
Possible solution: Check iptables and /etc/hosts.allow; /etc/hosts.deny
Problem 2
mount clntudp_create: RPC: Program not registeredPossible solution: chmod 644 /etc/hosts.allow
administrator's script: test.sh
#!/bin/bash# test# load parameters from prepare sectionsource prepare.sh#-> start routinels ${NFS_MOUNT_DIR}
#check the port stateecho `netstat -anp | grep "${NFS_PORT}"`
#<- end routine
Update
Use the operating system package managers to implement updates, upgrades and to delete a package. Specifically for the nfs updates and patches, refer into the following online resource: http://www.linux-nfs.org/
administrator's script: update.sh
#!/bin/bash# update#-> start routinesu -c 'yum update nfs-utils'
#<- end routine