NFS Server Linux Interview Questions

NFS Server Linux Interview Questions -Big Compilation

 

Q: Why to use NFS ?

Ans: A Network File System (NFS) allows remote machine to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers over the network.

Q: What is the default port of NFS server ?

Ans: By default NFS uses 2049 TCP port.

 

Q: What are different versions of NFS Server ?

Ans: Currently, there are three versions of NFS. NFS version 2 (NFSv2) is older and widely supported. NFS version 3 (NFSv3) supports safe asynchronous writes and is more robust at error handling than NFSv2; it also supports 64bit file sizes and offsets, allowing clients to access more than 2Gb of file data.

NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires an rpcbind service, supports ACLs, and utilizes stateful operations. Red Hat Enterprise Linux 6.X & Centos 6.X supports NFSv2, NFSv3, and NFSv4 clients. When mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv4 by default, if the server supports it.

 

Q: What are configuration files of NFS server ?

Ans: ‘/etc/exports’ is the main configuration file that controls which file systems are exported to remote hosts and specifies options.

‘/etc/sysconfig/nfs‘ is the file through which we can fix ports for RQUOTAD_PORT, MOUNTD_PORT, LOCKD_TCPPORT, LOCKD_UDPPORT and STATD_PORT

 

Q: What are different options used in /etc/exports file ?

Ans: Below are list of options used in /etc/exports file :

ro: The directory is shared read only; the client machine will not be able to write to it. This is the default.
rw: The client machine will have read and write access to the directory.
root_squash: By default, any file request made by user root on the client machine is treated as if it is made by user nobody on the server. (Exactly which UID the request is mapped to depends on the UID of user “nobody” on the server, not the client.)
no_root_squash : if this option is used , then root on the client machine will have the same level of access to the files on the system as root on the server. This can have serious security implications, although it may be necessary if you want to perform any administrative work on the client machine that involves the exported directories. You should not specify this option without a good reason.
no_subtree_check : If only part of a volume is exported, a routine called subtree checking verifies that a file that is requested from the client is in the appropriate part of the volume. If the entire volume is exported, disabling this check will speed up transfers.
sync : Replies to the NFS request only after all data has been written to disk. This is much safer than async, and is the default in all nfsutils versions after 1.0.0.
async : Replies to requests before the data is written to disk. This improves performance, but results in lost data if the server goes down.
no_wdelay : NFS has an optimization algorithm that delays disk writes if NFS deduces a likelihood of a related write request soon arriving. This saves disk writes and can speed performance
wdelay : Negation of no_wdelay , this is default
nohide : Normally, if a server exports two filesystems one of which is mounted on the other, then the client will have to mount both filesystems explicitly to get access to them. If it just mounts the parent, it will see an empty directory at the place where the other filesystem is mounted. That filesystem is “hidden”. Setting the nohide option on a filesystem causes it not to be hidden, and an appropriately authorised client will be able to move from the parent to that filesystem without noticing the change.
hide : Negation of nohide This is the default

 

Q: How to list available nfs share on local machine & remote machine ?

Ans: ‘showmount -e localhost’ : Shows the available shares on your local machine

‘showmount -e <Remoteserverip or hostname>‘: Lists the available shares at the remote server

 

Q: What is pNFS ?

Ans: Parallel NFS (pNFS) as part of the NFS v4.1 standard is available as of Red Hat Enterprise Linux 6.4. The pNFS architecture improves the scalability of NFS, with possible improvements to performance. That is, when a server implements pNFS as well, a client is able to access data through multiple servers concurrently. It supports three storage protocols or layouts: files, objects, and blocks.

 

Q: What is the difference between Hard mount & Soft mount in nfs ?

Ans: Difference between soft mount and hard mount is listed below :

Soft Mount : Consider we have mounted a NFS share using ‘soft mount’ .When a program or application requests a file from the NFS filesystem, NFS client daemons will try to retrieve the data from the NFS server. But, if it doesn’t get any response from the NFS server (due to any crash or failure of NFS server), the NFS client will report an error to the process on the client machine requesting the file access. The advantage of this mechanism is “fast responsiveness” as it doesn’t wait for the NFS server to respond. But, the main disadvantage of this method is data corruption or loss of data. So, this is not a recommended option to use.

 

Hard Mount : Suppose we have mounted the NFS share using hard mount, it will repeatedly retry to contact the server. Once the server is back online the program will continue to execute undisturbed from the state where it was during server crash. We can use the mount option “intr” which allows NFS requests to be interrupted if the server goes down or cannot be reached. Hence the recommended settings are hard and intr options.

 

Q: How to check iostat of nfs mount points ?

Ans: Using command ‘nfsiostat‘ we can list iostat of nfs mount points. Use the

below command :

# nfsiostat <interval> <count> <mount_point>

<interval> : specifies the amount of time in seconds between each report. The first report contains statistics for the time since each file system was mounted. Each subsequent report contains statistics collected during the interval since the previous report.

<count> : If the <count> parameter is specified, the value of <count> determines the number of reports generated at seconds apart. if the interval parameter is specified without the <count> parameter, the command generates reports continuously.

<mount_point> : If one or more <mount point> names are specified, statistics for only these mount points will be displayed. Otherwise, all NFS mount points on the client are listed.

 

Q: How to check nfs server version ?

Ans: ‘nfsstat -o all’ command shows all information about active versions of NFS.

 

Q: What is portmap?

Ans: The portmapper keeps a list of what services are running on what ports.

This list is used by a connecting machine to see what ports it wants to talk to

access certain services.

 

Q: How to reexport all the directories of ‘/etc/exports’ file ?

Ans: Using the command ‘ exportfs -r’ , we can reexport or refresh entries of

‘/etc/exports’ file without restarting nfs service

 

Q.How to mount the NFS shared file system in client

Ans: To Mount NFS share on the Client use below command :

# mount -t nfs IP_of_NFS_Server:/NFS_Share_Name   /mount_point

E.g.

# mount -t nfs nfs.linuxtechi.com:/nfs_data    /mnt/data

 

Q. What are the services required on nfs client and nfs servers ?

Ans: nfs*, rpcbind*, xinetd*

 

Q: – Explain this entry /shared 192.168.1.0/255.255.255.0(sync,rw)

Ans: Allows all systems with 192.168.1.* IP addresses read-write access to the /shared/ directory:

 

Q: – 192.168.1.51:/data is exported by NFS Server and i want to add this NFS share to client /etc/fstab file. How you will add this entry in /etc/fstab file?

Ans:

# device mount-point fs-type options dump fsckorder

192.168.1.51:/data /mnt nfs rw 0 0

 

Q: – What will happened if a space is given in between allowed_hosts and (options)

Ans: If a space is included, the options are applied to any and all IP addresses, which can be quite dangerous if write permission is granted.

 

Q: – What is “portmap”?

Ans: The portmapper keeps a list of what services are running on what ports. This list is used by a connecting machine to see what ports it wants to talk to access certain services.

 

Q: – What is the role of “sync” option for NFS server

Ans: If sync is specified, the server waits until the request is written to disk before responding to the client. The sync option is recommended because it follows the NFS protocol.

 

Q: – What do you understand by “nfsstat –nfs –server -3″ command?

It will show statistics for NFS version 3 server.

 

Q: – Can NFS share mounted on Window XP and Justify your answer?

Ans: No, Window XP operating system doesn’t support nfs protocol.

 

Q: – How to retrieve a list of clients connected to the NFS server ?

Ans: To retrieve a list of clients connected to the NFS server, use the showmount command from a shell prompt. To also show the directories the clients are connected to, use the showmount -a command.

 

Q: – Which kernel module is used by “rpc.nfsd”?

Ans: nfsd.o kernel module

 

Q: – Explain the working of NFS mount daemon “rpc.mountd”?

Ans: The rpc.mountd program implements the NFS mount protocol. When receiving a MOUNT request from an NFS client, it checks the request against the list of currently exported file systems. If the client is permitted to mount the file system, rpc.mountd obtains a file handle for requested directory and returns it to the client.

 

Q: –Name of Configuration file for NFS Server ?

Ans: /etc/exports

 

Q: – Explain option “all_squash”?

Ans: The UID and GID of exported files are mapped to the user anonymous. It is good for public directories.

 

Q: – Explain “exportfs” command?

Ans: The exportfs command is used to maintain the current table of exported file systems for NFS.

 

Q: – What is meaning of “no_root_squash” option ?

Ans: Treat remote root user as local root. Do not map requests from root to the anonymous user and group ID.

 

Q: – Explain “Soft Mounting” option at NFS Client?

Ans: If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. if it cannot be satisfied (for example, the server is down), then it quits. This is called soft mounting.

 

Q: – Explain “Hard Mounting” option at NFS Client?

Ans: If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. if it cannot be satisfied, then it will not quit until the request is satisfied. This is called Hard mounting.

 

Q: – What is NFS ?

Ans: NFS stands for Network File System. NFS was originally developed by Sun Microsystems in the 1980’s. NFS allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.

 

Q: – Which NFS versions are available?

NFS Version 2

NFS Version 3

NFS Version 4

 

Q: – What is the role of “rmtab” File for NFS Server?

For every mount request received from an NFS client, rpc.mountd adds an entry to the /var/lib/nfs/rmtab file.

When receiving an unmount request, that entry is removed.

 

Q: – What is “portmap”?

The portmapper keeps a list of what services are running on what ports. This list is used by a connecting machine to see what ports it wants to talk to access certain services.

 

Q: – What is different between NFS Version 2 & 3 ?

nfs 2 default 8kb transfer rate,it did not check the authentication at the time connection.client wants to access unauthorized file it shows error messages like “write error”,”read error” nfs 3 32kb transfer rate. It check at the time connection- ACL Support

 

Q: – Can NFS share mounted on Window XP and Justify your answer?

No, Window XP operating system doesn’t support nfs protocol.

 

Q: – Can we grant access by Username and password for nfs share?

No, access is granted only for IP address.

 

Q: – Which option is used with exportfs command to display the current export list, also displays the list of export options?

exportfs -v

 

Q: – Which option is used with exportfs command to re-export all directories?

exportfs -r

 

Q: – What is the role of “all_squash” option?

Treat all client users as anonymous users. Map all user and group IDs to the anonymous user and group ID.

 

Q: – Explain command “/usr/sbin/exportfs -f”?

It will flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next request.

 

Q: – How you will export directory (/data) to host 192.168.1.51, allowing asynchronous writes without adding the entry in /etc/exports file?

# exportfs -o async 192.168.1.51:/data

 

Q: – What is the role of “root_squash” option?

All requests from the user root are translated or mapped as if they came from the user anonymous (default).

 

Q: Is rpc.mountd daemon supports TCP_WRAPPERS?

Yes, The rpc.mountd daemon is protected by the tcp_wrappers. You have to give the clients access to rpc.mountd if they should be allowed to use NFS Server.

 

Q: Explain “nfsstat” command?

The nfsstat command displays the statistics about NFS client and NFS server activity.

 

Q: What do you understand by “nfsstat -o all -234” command?

It will Show all information about all versions of NFS.

 

Q: What do you understand by “nfsstat –nfs –server -3” command?

It will show statistics for NFS version 3 server.

 

Q: How you will check “portmap” service is running or not?

Ans: rpcinfo -p

 

Q: I am unable to mount a NFS share. How will you trace out the reason?

Ans: Firstly, check that you have permissions to mount nfs share or not. Check /etc/exports file.

Secondly you can get RPC error: Program Not Registered (or another “RPC” error)

For this check your NFS server and portmap service running or not by “rpcinfo -p”

 

Q: Can I modify export permissions without needing to remount clients in order to have them take effect?

Ans: Yes. The safest thing to do is edit /etc/exports and run “exportfs -r”.

 

Q: Explain NFS mount options ?

Syntax to mount NFS FS:

#mount  -t vfstype [-o options] NFS Servername:/exporteddirectory /mount point

or

#mount -t nfs -o options host:/remote/export /local/directory

Mount options explained below :

  1. -0 initr

This option is used in non reliable network, or network having more network

congestion. NFS request will be interrupted when server is not reachable.

  1. -o hard

If hard option is specified during nfs mount, user cannot terminate the process waiting for NFS communication to resume. For ex ..if u ran ls a command on ur NFS mounted directory but that time ur NFS server went down means . The process wont get killed or stopped ..it will wait until the NFS server and mount point become available.

  1. -o soft

If soft option is specified during nfs mount, user will get error alert when NFS server is not reachable. This is just inverse of hard mount option. It wont wait for reply if the NFS server went down , it will alert us and the process will go down.

  1. -o Nfsvers=value

If this option is specified during nfs mount NFS client uses particular NFS protocol version to communicate.

For example TCP

# mount- t nfs -o tcp 192.168.1.4:/mnt/array1/RHEL5  /data/

# mount | grep -i tcp

192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,tcp,addr=192.168.1.4)

 

Q: What is HARD and SOFT mount in NFS ?

In HARD mount …

If the NFS file system is hard mounted, the NFS daemons will try repeatedly to contact the server. The NFS daemon retries will not time out, will affect system performance, and you cannot interrupt them

If you just mount a file system without specifying hard or soft, the default is a hard mount. Hard mounts are preferable because of the stateless nature of NFS.

If a client sends an I/O request to the server (such as an ls -la), and the server gets rebooted, in client machine the process will keep on running. This preserves data transfers in the event of a server failure.

IN SOFT Mount :

A soft mount allows the client to stop trying an operation after a period of time. If the NFS server goes down at the time of data transfer , it will alert and the process will do down. This may cause the data corruption.

A soft link will return with an error and fail. you should only use soft mounts in the cases where client responsiveness is more important than data integrity. In another word soft mount will allow automatic unmount if the filesystem is idle for a specified time period.

 

Q. What is the difference between NFS share and a Samba share?

Ans: NFS sharing is done between linux to Linux where Samba sharing can be done between Linux‐Linux and Linux‐windows

 

Q. What is the default permission applied on the user when you mount a NFS permission on any local directory in your system?

Ans: no user permission which is a system account in all the machines having normal user level privileges unless no_root_squash or any other permission specification is not provided on the share

 

Q: Why to use NFS ?

Ans: A Network File System (NFS) allows remote machine to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers over the network.

 

Q: What is the default port of NFS server ?

Ans: By default NFS uses 2049 TCP port.

 

Q: What are different versions of NFS Server ?

Ans: Currently, there are three versions of NFS. NFS version 2 (NFSv2) is older and widely supported. NFS version 3 (NFSv3) supports safe asynchronous writes and is more robust at error handling than NFSv2; it also supports 64bit file sizes and offsets, allowing clients to access more than 2Gb of file data. NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires an rpcbind service, supports ACLs, and utilizes stateful operations. Red Hat Enterprise Linux 6.X & Centos 6.X supports NFSv2,NFSv3, and NFSv4 clients. When mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv4 by default, if the server supports it.

 

Q: What are configuration files of NFS server ?

Ans: ‘/etc/exports’ is the main configuration file that controls which file systems are exported to remote hosts and specifies options.

‘/etc/sysconfig/nfs‘ is the file through which we can fix ports for

RQUOTAD_PORT, MOUNTD_PORT, LOCKD_TCPPORT, LOCKD_UDPPORT and STATD_PORT

Q. What is different between NFS Version 2 & 3 ?

Ans: NFS 2 default 8kb transfer rate, it did not check the authentication at the time connection. Client wants to access unauthorized file it shows error messages like “write error”,”read error” nfs 3 32kb transfer rate. It check at the time connection ACL Support

 

Q. What is the role of “all_squash” option?

Ans: Treat all client users as anonymous users. Map all user and group IDs to the

anonymous user and group ID.

 

Q. What is the role of “root_squash” option?

Ans: All requests from the user root are translated or mapped as if they came from

the user anonymous (default)

 

Q. Explain “exportfs” command?

Ans: The exportfs command is used to maintain the current table of exported file

systems

Note: To retrieve a list of clients connected to the NFS server use show mount command

from Shell prompt: #showmount -a

 

What is NFS? What is its purpose?

Ans:

NFS is Network File system. It is a file system used for sharing of files over a network. Other resources like printers and storage devices can also be shared. This means that using NFS files can be accessed remotely. Nfs command in linux can be used to achieve this.

Purpose of NFS:

  • NFS can be used for sharing of files remotely.
  • Data can be stored on a single machine and still remain accessible to others over the network.
  • Reduction of the number of removable media drives throughout the network since they can be shared.

 

Q. What is Autofs and Its Advantages?

Ans:  Autofs , is auto mounting filesystem on demand like when ever you need it.

NFS is like mounting a complete partition remotely and you will have availability of whole content of the partition.

But there are few advantages with autofs over nfs

Advantages of AutoFS

  1. Shares are accessed automatically and transparently when a user tries to access any files or directories under the designated mount point of the remote filesystem to be mounted.
  2. Booting time is significantly reduced because no mounting is done at boot time.
  3. Network access and efficiency are improved by reducing the number of permanently active mount points.
  4. Failed mount requests can be reduced by designating alternate servers as the source of a filesystem.
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