Solaris NFS User Manual (network sharing)

Source: Internet
Author: User
Tags superuser permission nfsd
Solaris NFS User Manual (network sharing)-Linux Enterprise Application-Linux server application information. The following is a detailed description. All test environments are sun's solaris systems.

1. Understand the functions of nfs servers and clients.

Nfs is a product established by sun to use the TCP/IP protocol and sun's remote call and external data representation specifications. Nfs is very convenient and reliable. He has the ability to share files between different operating systems.
Nfs servers can use nfs to allow other remote machines to share their local resources. An nfs client is a machine that accesses the shared resources of an nfs server. In practice, a host can be an nfs server or an nfs client. They can share and access each other.
As long as you can understand the differences between the nfs server and the nfs client. The rest is easy.

2. Differences between an nfs server and an nfs client.
2. 1 solaris shares resources using distributed file systems or dfs commands. Shared resources can be set manually or automatically.
The nfs server runs two Hou processes: mountd and nfsd.
The files used are:
/Etc/rc3.d/S15nfs. server
/Etc/dfs/dfstab
/Etc/dfs/sharetab
/Etc/rmtab
Run the following command on the nfs server: share unshare all unmounted all dfshares dfmounts.

The following processes run on the nfs client are statd and lockd.
The files used are:
/Etc/vfstab
/Etc/mnttab
Nfs client command: mount umount mountall umountall showmount

2. 2. nfs server settings
The nfs server needs to run two Hou processes: mountd and nfsd. When an nfs client attempts to access a remote nfs server resource. The nfs client uses the mount command to request a connection to the mountd daemon process of the nfs server. When the nfs server responds to the client, it returns a message to the user. The client writes this information to the local/etc/mnttab file. This information is the information of shared files and directories on the server. It is the encoding of resource information, such as the disk device number, node generation number, and node number. This is unique.
Once the user can obtain the request information, the mountd process on the nfs server will add a message to the local/etc/rmtab file of the server. This is to keep track of the files currently loaded on the user machine. This file adds an entry for each loaded resource in the following format:
Remote hostname: local filename name

Note: The old entries in the/etc/rmtab file of the server will be updated every time mountd restarts and the user can send an unmount request.

2, 3 Share settings command.
After understanding the above principles, the specific operations are described below. The nfs server uses the/usr/sbin/share command to share resources with the client.
Command details:
# Share --- display all resources that can be installed, whether or not they have been installed.
# Share [-F filesystem] [-o options] [-d description] pathname-to-resource
--- Specify the shared file.
*-F file system type specifies the public file system type.
*-O options specifies the type of the client's access to the resource.
*-D description: a brief description of the resources that are shared. When you run the share command without any parameters, it will be displayed.
* Pathname-to-resource Name shared by the server.
------------------------------------------------------
*-O specifies the permissions that allow users to access shared resources. The details are as follows:
Rw indicates that the user can read/write data, which is the default setting.
Rw = client1: client2 indicates that the user can have read/write permissions. There can be many users separated by colons.
Ro indicates read-only.
Ro = client1: client2 specifies that the user client1 and client2 are read-only. Client1 can be a host name, an IP address, or a CIDR block. Example: ro = @ 202.99.88.0/24
Root = client: client2 specifies that the root user on client1 and client2 has the superuser permission to share resources. However, the priority is smaller than the local permission of the nfs server.

For example, the user peng has a directory/exprot/home/games to share.
# Share-F nfs-o rw = lnx3000: race, ro = @ 202.88.99.0/24: sune450, root = mmmmn-d "I love MM! "/Export/home/peng/games
Running result: Shared/exprot/home/peng/games directory. The two hosts named lnx3000 and race have read/write permissions; 202.88.99.0 the class c network machine and the sun450 host only have the read permission. the root user of the mmmmn host can have the superuser access permission on the shared resources. However, if I read the shared directory/exprot/home/peng/games only, the root permission of mmmmn is useless and can only be read-only. Because the local permission on the server is greater than the permission on any share ..

Cancel share resource.
# Unshare [-F nfs] path-to-resource
*-F nfs specifies the system type. Default Value.
* Path-to-resource specifies the shared path.
For example:
# Unshare/export/home/peng/games
The shared resource is canceled.

2. 4. automatically share resources upon startup.
The preceding command method disappears when the machine is restarted. How to retain and enable nfs sharing automatically at startup. We can use the/etc/dfs/dfstab file to automatically share files. As long as the host starts to run level 3, nfs Resource Sharing is automatically started.
1. Edit the/etc/dfs/dfstab file and add:
Share [-F filesystem] [-o options] [-d description] pathname-to-resource
----- This is the same as the command line...
2. #/etc/init. d/nfs. server start
In this case, OK.

3. Manual Quick Command.
# Share all -- share all resources that are listed in/etc/dfs/dfstab.
# Unshared all -- Cancel all shared resources in/etc/dfs/dfstab.

2. View resources.
# Dfshares
Used to view the shared resources of the server. The input format is as follows:
Resource server access transprot
* Host and Path Name of the resource that can be remotely called.
* The system name of the resource specified by server.
* The permission specified by the access Server. The default value is rw, and "-" is displayed.
* Transport specifies the port of the shared resource.

# Dfmounts command
Displays the status of shared resources on the server. The output format is as follows:
RESOURCE SERVER PATHNAME CLIENTS
* Resource shared data name.
* Server pathname shared data directory.
* Client connected.

# Nfsstat
View All nfs statuses

3. nfs client settings.
After installing the nfs server, you can use the client to share data. First, check the nfs server and install it.

3. 1. Check the nfs server.
# Showmount [-ade]
*-A shows the used resources and nfs servers.
*-D indicates the resources that have been remotely installed.
*-E shows resources that can be installed. Generally, you can use-e to view the available resources of the remote host.

3. Create a share.
# Mount [-F nfs] [-o options] path-to-resource path-to-local-mount-point
*-F nfs specifies the shared file system, which is default. No need to specify.
*-O options specifies options, such as permissions. The default value is rw, which can be read/written. Or ro-read-only.
* Path-to-rescource specifies the Host Name and shared resource path of the nfs server.
* Path-to-local-mount-point specifies the local mount point for shared resources.

For example:
# Mkdir/export/home/games
# Mount peng:/export/home/peng/games/exprot/home/games
Share the/export/home/peng/games directory of the remote host peng, which can be read/written and mounted to the local/exprot/home/games directory.

3. Cancel sharing.
# Umount [-F nfs] remote-path-to-resource path-to-local-mount-point
*-F default nfs file system.
* Remote-path-to-resource remote host and shared directory path. The host and shared directory paths are separated by colons.
* Path-to-local-mount-point: local host mount point.

For example:
# Umount peng:/export/home/peng/games/export/home/games
Cancel sharing of the/exprot/home/peng/games directory on the remote host peng on the local/export/home/games.

3. 4. The system automatically shares data when it is started.
Modify the/etc/vfstab file in the following format:
Device to mount device to fsck mount point FS type fsck pass mount at boot mount options

* Device to mount specifies the remote server name and shared path. The remote server names and sharing paths are separated by colons.
* Device to fsck is empty. File detection is never performed from the client.
* Mount point specifies the local mount point. This directory must already exist.
* FS type is of course nfs for the nfs resource system.
* Fsck pass is empty. Indicates that file system detection is not performed from the client.
* Select "yes" or "no" for "mount at boot", and "yes" indicates automatic installation at startup.
* List of mount options commands separated by commas.

For example:
# Add vi/etc/vfstab:
Peng:/export/home/peng/games-/export/home/games nfs-yes soft, bg

Indicates that the/export/home/peng/games directory of the remote host peng is automatically mounted to the/export/home/games directory of the local host. The soft option indicates that the directory cannot be installed, resulting in an error. Bg option, which is installed in the background during system startup.
For more information about the parameters of mount options, use man mount.

3. 5. Manually debug the command.
# Mountall
Install all resources listed in the/etc/vfstab file in mount at boot with no parameters.
# Mountall-r only affects remote files
# Mountall-l only affects local files

# Umountall
Without any parameters, the resources that have been installed are retained. Excluding/,/proc,/usr, And/var. In addition, the system is busy and may not be uninstalled.
# Umountall-r only affects remote files
# Umountall-l only affects local files

Section:
Here I think there should be no problem.
Note the difference between the client and the server.
The nfs server runs the Houyi process mountd and nfsd.
File/etc/dfs/dfstab,/etc/dfs/sharetab,/etc/rmtab are used on the nfs server.
Run the following command on the nfs server: share unshare all unowned all

The nfs client runs the statd and lockd processes.
The files used are/etc/vfstab and/etc/mnttab.
Nfs client command: mount umount mountall umountall
If you know this, you will be OK.

FAQ:
1. Run the mount command to get the shared resource. The message "nfs server not responding" is displayed ".
Answer: Make sure that nfsd and mountd are running on the server, and the resources have been correctly shared using the sharing command.
2. When I try to share a disk to a local disk, the error is: "mount:/tmp_mount not found ".
Answer: Have you created a mount point locally...

3. # showmount-e 192.168.200.200
Showmount: 192.168.200.200: RPC: Rpcbind failure-RPC: Unable to receive

The firewall of 192.168.200.200 disconnects.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.