Mount NFS file sharing in UNIX systems

Source: Internet
Author: User
Mount NFS file sharing in UNIX System-Linux Enterprise Application-Linux server application information. For more information, see. Similar to windows Network Sharing, UNIX (Linux) systems also have their own network sharing, that is, NFS (Network File System ), next we will take SUN Solaris2.8 and REDHAT as server 3 as an example to briefly introduce how to mount nfs network sharing in linux. Before mounting an NFS disk to a linux client, you must configure the NFS server.

1. Configure the NFS server of the Solaris system as follows:
(1) Modify/etc/dfs/dfstab to add a shared directory.
Share-F nfs-o rw/export/home/sunky
(2) Start the nfs service
#/Etc/init. d/nfs. server start
(3) After the NFS service is started, you can also use the following command to add a new share.
# Share/export/home/sunky1
# Share/export/home/sunky2
Note:/export/home/sunky and/export/home/sunky1 are shared directories.

2. Configure the NFS server in linux as follows:
(1) Modify/etc/exports to add a shared directory.
/Export/home/sunky 10.140.133.23 (rw)
/Export/home/sunky1 * (rw)
/Export/home/sunky2 linux-client (rw)
Note: sunky, sunky1, and sunky2 under the/export/home/directory are the shared directories, 10.140.133.23, *, and linux-client are IP addresses or host names allowed to connect to the shared linux client. If you want to use the host name linux-client must be on the server host
Add the linux-client host ip definition in the/etc/hosts file. The format is as follows:
10.140.133.23 linux-client
(2) start and stop the NFS service
/Etc/rc. d/init. d/portmap start (PORTMAP is started by default in REDHAT)
/Etc/rc. d/init. d/nfs start the NFS service
/Etc/rc. d/init. d/nfs stop NFS service
Note: If a new share is added to the/etc/export file, stop the NFS service and then start the NFS service to make the new share take effect. The command exportfs-rv can also achieve the same effect.

3. mount the NFS share of other linux or UNIX systems on the linux Client
# Mkdir? P/mnt/nfs
Note: create a directory for mount point)
# Mount-t nfs-o rw 10.140.133.9:/export/home/sunky/mnt/nfs
Note: here we assume 10.140.133.9 is the IP address of the host on the NFS server. Of course, the host name can also be used, but the Server ip definition must be added to the local/etc/hosts file. /Export/home/sunky is the directory shared by the server. In this way, you can use/mnt/nfs on the linux client to access files shared by NFS on other linux or UNIX systems. The preceding operations are successfully performed in redhat as server 3, redflag server4.1, suse server 9, Solaris 7, Solaris 8, and Solaris 9 forx86 & iSCSI environments.
Permission issues:
Assume that the user jack on the server side has a user id of 1818, A gid of 1818, and a user jack on the client side, but the uid and gid are 1818. The client jack wants to fully read and write the/home/jack directory on the server. The/etc/exports on the server is written as follows:
/Home/jack * (rw, all_squash, anonuid = 1818, anongid = 1818)
This configuration file means that when all client users access the/home/jack directory of the server, it will map to the jack (uid, gid = 1818) of the server ). My mount result is
1. The root of the client can fully access this directory, including reading, writing, and killing ...... And so on
2. client jack (uid, gid = 1818) I can do:
Rm-rf server_jack /*
Cp something server_jack/
Mkdir server_jack/
Umount: detach a file Device
[Root @ centos57 ~] # Umount/dev/hda1 unmount with the device file name
[Root @ centos57 ~] # Umount/aixi unmount with a mount point
Umount:/aixi: device is busy. If you are prompted that the device is busy, run the following command to uninstall it:
# Umount-l/mnt/hda1 option? L not umount immediately, but umount again after the directory is idle.
If the problem persists, run the following command:
# Umount-f/mnt/hda1-f indicates force uninstall
If not, use fuser-m? V/dev/hda1 to query which programs are in use. Once these processes are completed, they can be uninstalled.
[Root @ centos57 aixi] # sync & fuser-m/dev/hda1? K. You can uninstall it after using this command.
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.