Posted by: isaraffee | April 21, 2010

Exploring NFS in Vector Linux with Ubuntu Jaunty as Client

Exploring NFS in Vector Linux with Ubuntu Jaunty as Client

Vector Linux is configured as the NFS server

Check that the NFS package is install

root:# slapt-get –installed | grep nfs

nfs-utils-1.0.10-i486-3 [inst=yes]: nfs-utils (Network File System daemons and utilities)

root:# slapt-get –installed | grep portmap

portmap-5.0-i486-3 [inst=yes]: portmap (a daemon to manage RPC connections)

Check where to start the NFS server daemon

root:# cd /etc/rc.d

vector://etc/rc.d

root:# ./rc.nfsd

Important Notes

If you are thinking of making Vector Linux as the ssh or NFS server, you must stop the firewall service by typing:

#cd /etc/rc.d

#./rc.firewall stop

Otherwise your ssh or NFS share will not be accessible from remote hosts. I wrote a rc script which will stop the firewall services, before the server starts the NFS and SSH. Follow the steps, and I remind you that this is for Vector linux.

root:# cd /etc/rc.d

vector://etc/rc.d

root:# cd rc4.d/

vector://etc/rc.d/rc4.d

root:# ls

K49ifplugd@ S50ifplugd@ S76tembokapi* S99cups*

K76firewall@ S70firewall@ S77nfsd* S99sshd*

vector://etc/rc.d/rc4.d

The rc script is called S76tembokapi. Make sure the script name begins with letter S (means start) and that the number is after the firewall script S70FIREWALL. That’s why I chose number 76; after the firewall start and before the nfsd and sshd scripts started.

Create a directory to be shared

root:# cd /root/Desktop/

vector:/~/Desktop

root:# mkdir TopHits

vector:/~/Desktop

root:# vi somefile.txt

Write some things to the file and save.

Let’s check if the nfsd service is running on the NFS server (the Vector Linux)

root:# ps -ef|grep nfs

root 3417 3372 0 08:00 pts/3 00:00:00 grep nfs

It shows that nfs server is not running

But before we start it let’s edit the /etc/exports file

Edit the /etc/exports

Add a line that looks like this:

/root/Desktop/TopHits 172.16.0.2/255.255.0.0(rw,no_root_squash)

The IP address here is the NFS client, which is my case is the Ubuntu Jaunty.

After that run the following command to export the folders.

root:# exportfs -a -v

exportfs: /etc/exports [1]: Neither ‘subtree_check’ or ‘no_subtree_check’ specified for export “172.16.0.2/255.255.0.0:/root/Desktop/TopHits”.

Assuming default behaviour (‘subtree_check’).

NOTE: this default will change with nfs-utils version 1.1.0

exporting 172.16.0.2/255.255.0.0:/root/Desktop/TopHits

Make sure you have the /root/Desktop/TopHIts created on your ssh server, otherwise you are not sharing anything.

Now let’s restart the NFS server:

Before that we also note that for NFS to work, you need the rpc portmap and nfs service running. Now we already know how to check for nfs service. To check for the rpc portmap type:

vector://etc

root:# ps -ef|grep portmap

root 3423 3372 0 08:06 pts/3 00:00:00 grep portmap

vector://etc

root:# ps -ef|grep rpc

root 3425 3372 0 08:06 pts/3 00:00:00 grep rpc

Ok let’s start the NFS server on the Vector Linux

root:# cd /etc/rc.d

vector://etc/rc.d

root:# ./rc.nfsd start

Starting RPC portmapper: /sbin/rpc.portmap

Starting RPC kernel lockd process: /sbin/rpc.lockd

Starting RPC NSM (Network Status Monitor): /sbin/rpc.statd

Starting NFS server daemons:

/usr/sbin/exportfs -r

exportfs: /etc/exports [1]: Neither ‘subtree_check’ or ‘no_subtree_check’ specified for export “172.16.0.2/255.255.0.0:/root/Desktop/TopHits”.

Assuming default behaviour (‘subtree_check’).

NOTE: this default will change with nfs-utils version 1.1.0

/usr/sbin/rpc.rquotad

/usr/sbin/rpc.nfsd 8

/usr/sbin/rpc.mountd

Check for the necessary services:

root:# ps -ef|grep rpc

bin 3453 1 0 08:08 ? 00:00:00 /sbin/rpc.portmap

root 3462 1 0 08:08 ? 00:00:00 /sbin/rpc.statd

root 3465 1 0 08:08 ? 00:00:00 /usr/sbin/rpc.rquotad

root 3478 6 0 08:08 ? 00:00:00 [rpciod/0]

root 3479 1 0 08:08 ? 00:00:00 /usr/sbin/rpc.mountd

root 3496 1 0 08:10 ? 00:00:00 /usr/sbin/rpc.rquotad

root 3499 1 0 08:10 ? 00:00:00 /usr/sbin/rpc.mountd

root 3501 3372 0 08:10 pts/3 00:00:00 grep rpc

root:# ps -ef|grep nfs

root 3467 6 0 08:08 ? 00:00:00 [nfsd4]

root 3468 1 0 08:08 ? 00:00:00 [nfsd]

root 3469 1 0 08:08 ? 00:00:00 [nfsd]

root 3470 1 0 08:08 ? 00:00:00 [nfsd]

root 3471 1 0 08:08 ? 00:00:00 [nfsd]

root 3472 1 0 08:08 ? 00:00:00 [nfsd]

root 3473 1 0 08:08 ? 00:00:00 [nfsd]

root 3474 1 0 08:08 ? 00:00:00 [nfsd]

root 3475 1 0 08:08 ? 00:00:00 [nfsd]

root 3505 3372 0 08:11 pts/3 00:00:00 grep nfs

rpcinfo utility

The rpcinfo utility displays information about programs registered with portmap and makes RPC calls to programs to see if they are alive

Type the command:

# rpcinfo -p ubuntu.example.com

You can replace the hostname with IP address or localhost.

Use the -u option to display a list of versions of a daemon registered on a host

# rpcinfo -u ubuntu.example.com nfs

program 100003 version 2 ready and waiting

program 100003 version 3 ready and waiting

program 100003 version 4 ready and waiting

Now let’s configure the NFS client on the Ubuntu Jaunty

Firstly, make a directory at the client

# mkdir /mnt/share

Next mount the shareon the NFS client and in my case it’s Ubuntu Jaunty:

# mount -t nfs 172.16.0.1:/root/Desktop/TopHits /mnt/share

Check to see if it is mounted

root@ismail-laptop:~# mount

# mount

/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)

tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)

proc on /proc type proc (rw,noexec,nosuid,nodev)

<lines truncated for brevity>

172.16.0.1:/root/Desktop/TopHits on /mnt/share type nfs (rw,addr=172.16.0.1)

Look at the last entry. It shows that the NFS share is mounted.

Let’s edit the file from the NFS client

# cd /mnt/share/

root@ismail-laptop:/mnt/share# ls

somefile.txt

root@ismail-laptop:/mnt/share# vi somefile.txt

hello world

hi earthlings! Greetings from mars.

You can also check that the file is updated on the NFS server

To unmount the share on the NFS client, type:

#umount /mnt/share

Note:

Based on several tests, NFS server service in Vector Linux will not start unless you have NFS share entries in your /etc/export file. If the file is blank, nfs services will not even work.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: