| |
Practical Exercises with NFSv3
1. Setup your desktop machine as NFS client and your cluster node as
NFS server, following the instructions below.
Install the NFS related packages by using apt-get.
On your node:
On the desktop:
On your node, create a directory on top of your home directory to export it,
for example,
Create a dummy user and create his home directory in /home/exports:
Copy some files from /etc into directory /home/exports/jonny and
give them ownership "jonny":
Then
and live it a root ownreship.
Modify file /etc/exports to include export of directory
/home/exports to your desktop,
for example, desktop02:
Make sure your desktop and its IP address are included in /etc/hosts file.
Start portmap and NFS services:
Make sure the services are running by executing command rpcinfo:
You should see the following:
On the desktop machine run rpcinfo pointing at the server
If you see the same output as on the NFS server, it means the server
allows you to access the portmap and its rpc services.
Check what directories are exported to you from the server:
It should show
Now you are ready to mount its directory on the node.
Create a new mounting point and mount the exported directory onto it:
To make sure the directory has been mounted, run command
The mounted directory shows up in the bottom of the file
systems list:
To see who is the owner of the files
in the directory, run command
Since there is no user with UID=666 and GID=666
on the node,
the mounted directory would belong to a non-existent user:
Create user jonny with UID=GID=667 and
try to change the ownership of the directory on the node:
It doesn't work.
Change the UID and GID of jonny to be consistent with those on the NFS server:
Become user jonny then step into directory /home/exports:
and see if you can create files in
this directory.
Unmount the directory,
Modify file /etc/fstab by including a new entry with
/home/exports:
Then run
Check if it is mounted
Remove the entry from /etc/fstab and unmount the directory.
If the directory can not get unmounted and you receive error message
"device is busy", check what processes hold the directory by executing
command fuser:
For example,
Kill these processes and try to unmount the directory again.
Try to avoid NFS mounting through /etc/fstab. Use either
manual mount or automount.
2. Mount the directory on the desktop again. Shutdown the NFS server on your
node:
Try to access the NFS mounted directory, for example, with ls.
Try Ctrl_C to unfreeze the
terminal.
Start the NFS server on you node
and try to access the directory again.
3. Repeat exercise #2 using options rw,intr,hard in
command mount.
4. Repeat exercise #2 using options rw,intr,soft in
command mount. Wait for 30 - 60 seconds until it times out.
5. Observing stale file handle error.
On the NFS server, create a new directory tree under NFS exported directory:
On the client, step into the directory:
On the NFS server, remove directory test with its subdirectory:
On the client, run
6. Finding the optimal write and read block sizes (wsize, rsize).
Modify /etc/exports on the NFS server to allow root access to the
exported directory on the client:
Re-export the directory
On the desktop, mount the directory with read and write block sizes
option rsize=1024,wsize=1024:
To make sure the directory is accessible, run command
Check the time (real time) it would take to write 1.6 MB file over
the NFS:
Check how long it would take to read this file:
Unmount the directory.
Repeat the same procedure with rsize = wsize =
2048, 4096, 5125, 8192, 10240, block sizes (they are N*1024 Bytes).
What is the optimal block size?
7. Protecting portmap with tcp_wrappers.
Unmount the NFS directory on the desktop. On the NFS server, put
entry for portmap into /etc/hosts.deny:
Try mounting the directory on the desktop.
On the NFS server, in file /etc/hosts.allow, put entry allowing to
mount the directory on your node:
8. Install autofs on the desktop machine (NFS client).
Configure the master map file, /etc/auto.master, and specify the
timeout 60 seconds:
Make sure directory /mnt already exists.
Configure the indirect map file, /etc/auto.exports:
Restart or reload autofs:
Access the file system and check if it gets mounted:
Run command df -h again after about a minute.
|
|