Sunday, December 13, 2015

How to export and mount the nfs filesystem in aix?

How to export and mount the nfs filesystem in aix?


1. Ground work:
We need the below information in hand and confirm the required deamon status.
            ü  Nfs Server name
            ü  Exported directory
            ü  Nfs Client name
            ü  Nfs local mount point name.
            ü  check showmount -e  --> To confirm the exported directory list.
            ü  showmount -a  --> To confirm the list of nfs client server names.

Server Side Configuration: Start the NFS and portmap daemon

# lslpp –L | grep bos.net*  --> Check the nfs server and client installed.
# startsrc –g nfs  --> start the nfs group deamon
# startsrc -s nfsd   --> start the nfsd deamon
# startsrc -s mountd  --> start the mountd deamon
# lssrc -g nfs  --> check the nfs group deamon in active state
# lssrc -s  nfsd  --> Check the nfsd deamon
# lssrc -s mountd  --> check the mountd deamon

•   Client Side Configuration:      Start the NFS and portmap daemon

# lslpp –L | grep bos.net*  --> Check the nfs server and client installed
# startsrc –g nfs   --> start the nfs group deamon
# startsrc –s portmap  --> start the portmap deamon.
# lssrc -s nfsd  --> check the nfs group deamon in active state
# lssrc -s portmap  --> Check the protmap deamon in active state.
# lssrc -s biod   --> Check the biod deamon in active state.


2. Exporting an NFS filesystem

Using Smitty:
# ls -l /etc/exports  --> Check exports file exits.
# cp -p /etc/exports /etc/exports_bak   --> Take the backup of the exports file.
# smitty mknfsexp  --> Exporting the nfs filesystem.
            Specify appropriate values in the PATHNAME of directory to export
             MODE to export directory,
            EXPORT directory now, system restart or both fields.
# cat /etc/exports  --> To confirm the exported directory are present on the /etc/exports.

Using Command line:

# cp -p /etc/exports /etc/exports_bak   --> Take the backup of the exports file.
# vi /etc/exports  --> To Create an entry for each directory to be exported, using the full path name of the directory.
# exportfs -a  --> To read the /etc/exports file and exports all the directories listed.
# showmount -e  --> To confirm the exported directory listed.
# showmount -a  --> To confirm the nfs client name and directory list.


3. Mounting the NFS filesystem on the client.

Using Smitty:
# showmount -e <server_name>  --> To verify the NFS server has exported the directory.
# mkdir /local_directory    --> To create the mounting directory if not already exist.
#  smitty mknfsmnt  --> mount the NFS filesystem.
            PATHNAME of mount point.
            PATHNAME of remote directory.
            HOST where remote directory resides.
            MOUNT now, add entry to /etc/filesystems or both?
            /etc/filesystems entry will mount the directory on system RESTART.
            MODE for this NFS file system.
 #df -gt <NFS mount_name>  --> To confirm the nfs filesystem has been mounted

Using Command line:
# showmount -e <server_name>  --> To verify the NFS server has exported the directory.
# mkdir /local_directory    --> To create the mounting directory if not already exist.
# mount ServerName:/remote/directory /local/directory 
 #df -gt <NFS mount_name>  --> To confirm the nfs filesystem has been mounted



4. Roll back

Unexporting the NFS filesystem on the NFS server

Using Smitty:

Login to the NFS server and follw the below procedure.
# cp -p /etc/exports  --> To copy the exports directory.
# smitty rmnfsexp  --> To unexport the nfs directory.

Using command line:
# vi /etc/exports --> To Find the entry for the directory you wish to unexport, and the delete that line.
# cat /etc/exports   --> To check the directory now is removed and unexported.
If NFS is current running,
#exportfs -u <directory_name  --> where dirname is the full path name of the directory you just deleted from the /etc/exports file.


Removing the NFS mount on the NFS client server.

Using Smitty:
#smitty rmnfsmnt
# cat /etc/filesystems  --> To confirm the entry has been deleted properly.

Using command line:
#umount <directoryname>   --> To unmount the directory.
# cp -p /etc/filesystems /etc/filesystems_bak   --> To take the backup of the /etc/filesytems file.
# vi /etc/filesystems  --> Find the entry for the directory you just unmounted, and then delete it.
# cat /etc/filesystems  --> To confirm the entry for the directory you just unmounted properly.


Note: If you happy about the above article, please leave your comments / Reactions.