Sie sind auf Seite 1von 5

Network file system (NFS) is a client-server application that lets users view, store, and update files on a remote

system as though the files were on a local system.


NFS Environment

An NFS environment consists of two components:


y y

The NFS server, which contains file resources that are shared with other systems The NFS client, which mounts file resources that are shared over the network and presents the resources as if they were on a local system

NFS Server Files


y y

/etc/dfs/dfstab lists the resources to share at boot time. /etc/nfs/nfslogd.conf defines the location of the configuration

logs that are used for

NFS server logging. /etc/dfs/sharetab lists local resources that are currently being shared by the NFS server. /etc/rmtab lists the file systems remotely mounted by NFS clients. Do not edit this file. /etc/nfs/nfslog.conf lists information defining the location of the configuration logs used for NFS server logging.

Format of dfstab File


# cat /etc/dfs/dfstab # Place share(1M) commands here for automatic execution # on entering init state 3. # # Issue the command 'svcadm enable network/nfs/server' to # run the NFS daemon processes and the share commands, after adding # the very first entry to this file. # # share [-F fstype] [-o options] [-d "<text>"] <pathname> [resource] # .e.g, # share -F nfs -o rw=engineering -d "home dirs" /export/home2

For example, here we have a home directory called /nfsserver that's shared in readonly mode:
share -o ro /nfsserver

NFS Server Daemons in the Solaris 10 OS

Description of daemons:
y

y y

y y

handles file system mount requests from remote systems and provides access control. Not used in NFSv4. nfsmapid is the NFS user and group ID mapping daemon, which is used with NFSv4. nfsd handles client file system requests and is used with NFSv4. statd works with the lockd daemon to provide crash recovery and functions for the lock manager. lockd supports record locking operations on NFS files. nfslogd provides operational logging for NFSv2 and v3.
mountd

With the Solaris 10 OS and NFSv4, you need only two daemons to support NFS: nfsmapid and nfsd. The mountd and lockd daemons are integrated together, and nfsmapid and nfsd are supported in NFSv4 with port 2049, which improves support for NFS through a firewall. If you want to use NFSv2 or v3 with the Solaris 10 OS, all daemons are supported.
Starting and Stopping the NFS Server Service

The svc:/network/nfs/server service starts the NFS server daemons when the system enters run level 3. To start the NFS server daemon manually, run this command:
# svcadm enable svc:/network/nfs/server

To stop the NFS server daemon manually, run this command:


# svcadm disable svc:/network/nfs/server

Checking NFS Dependencies

Check dependencies using the svcs command:


# svcs | grep nfs # svcs -l nfs/server

NFS Server Commands


y y

reads and executes statements from /etc/dfs/dfstab. shares makes a local directory on the NFS server available for mounting.
shareall

dfshares,

when used without any arguments, displays resources currently being

shared.
y y

displays a list of NFS server directories that are currently mounted. unshare makes file resources unavailable for mounting.
dfmount

Configuring the NFS Server for Sharing

Syntax:
# share [-F <FSType>] [-o <option>] [<pathname>]

where:
y y

specifies the file system type. -o <option> specifies the options that control access to the shared resource, for example read-only access. <pathname> specifies the absolute path name of the resource for sharing.
-F <FSType>

For example, if you want to share the /nfsserver directory, make an entry like the following in the /etc/dfs/dfstab file:
#share -F nfs -o ro /nfsserver

In this example, -F specifies an NFS file system, -o ro specifies that access to the share is read-only, and /nfsserver is the absolute path of the share. Similarly, by using the -o rw option, you can specify that <pathname> is shared as read/write to all clients, and you can use -o root=<dir_name> to enable root privileges for the <dir_name> directory.
Making File Resources Unavailable for Mounting

Syntax:
# unshare [-F <FSType>] [<pathname>]

For example:
#unshare -F nfs /nfsserver

Mounting a Remote File System

Syntax:

mount [-F <FSType>] [-o <options>] <server>:<pathname> [<mount_point>]

For example:
# mount -F nfs -o ro radical1:/nfsserver /mymountpoint

where:
y y y

Radical1 is the name of the remote server. /nfsserver is the remote file resource. /mymountpoint is the mount point where /nfsserver is shared.

Another example:
# mount -o ro Radical1,Sun,Moon :/Central_data /mymountpoint

In the second example, if the Radical1 system is unavailable, then the request will flow to the second system, which is called Sun, and so on.
Unmounting Remote File Systems From a Client

Syntax:
umount [<mount_point>]

For example:
# umount /mymountpoint

Mounting Remote Resources at Boot Time

To mount a remote file system at boot time, make an entry in /etc/vfstab. For example, add the following entry in the /etc/dfstab file:
Radical1:/nfsserver - /mymountpoint nfs - yes bg

where:
y y y y y

device to mount device to fsck

is Radical1:/nfsserver

is mount point is /mymountpoint FS type is nfs fsck pass is -

y y

is yes mount options is bg (for background)


mount at boot

Das könnte Ihnen auch gefallen