NFS (Network File system-NET filesystem)

Source: Internet
Author: User

a contract that is used for decentralized file systems. The function is to enable different machines, different operating systems to share individual data with each other, so that the application can access the data on the server disk through the network, and it is a way to implement disk file sharing among Unix-like systems.

the basic principle of NFS is to allow different clients and services to share the same file system through a set of RPCs. It is independent of the operating system, allowing different hardware and operating systems to be shared by the West through joint documentation.

RPC(remoteprocedure call- ) is a mechanism that enables clients to execute programs in other systems.

Turn off firewall and SELinux, use server1 with server2 virtual machine,Server1 Share files.

1). Install NFS software

Yum Install Nfs-utils-y

Systemctl Start Nfs-server

Systemctl Enable Nfs-server

2). set up shared content

MKDIR/NFSHARE/NFS{1..5}-P

3). Modify the configuration

Vim/etc/exports

@@

/nfshare 172.25.254.1/24 (RO)

@@

# # The first column /nfshare indicates the directory that needs to be shared

# #IP indicates which client access is allowed

# #IP the settings in parentheses indicate permissions on the shared file

ro # # read-only access

RW # # Read and write access

Sync # # All data is written to share on request

Hide # # does not share its subdirectories in the NFS shared directory

No_hide # # subdirectories of shared NFS directories

all_squash  total ## UID  and   GID  map anonymous user anonymous, suitable for public directories.

No_all_squash # # Keep the UID and GID for shared files ( default )

Root_squash # #root all requests from the user are mapped to the same permissions as the anonymous user ( default )

No_root_squas # #root users have full administrative access to the root directory

Permissions

EXPORTFS-RV # # Refresh the configuration for the configuration to take effect

[Email protected] ~]# Vim/etc/exports

@/nfshare 172.25.254.1/24 (rw) @

[Email protected] ~]# EXPORTFS-RV

Exporting 172.25.254.1/24:/nfshare

[Email protected] ~]# showmount-e 172.25.254.1

Export list for 172.25.254.1:

/nfshare 172.25.254.1/24

* * Manual Mount

Yum Install Nfs-utils-y

Mkdir/mnt/nfsmount // Create client mount directory

showmount-e 172.25.254.1 // display a directory shared by an IP

Mount 172.25.254.1:/nfshare/mnt/nfsmount // hang in shared directory to local

Vim/etc/fatab // permanent Mount

```

Add the following line after the file

172.25.254.1:/nfshare/mnt/nfsmount nfs4 Defaults 0 0

```

Note : nfs,cifs also belongs to the file system format , which is the network file system format.

* * automatically mounts to default directory

Yum Install Autofs-y

Systemctl Start AutoFS

Systemctl Enable AutoFS

cd/net/172.25.254.1 // access the server-side shared directory

Vim/etc/sysconfig/autofs // Modify time to release mount Resources

```

Timeout=5

```

[Email protected] ~]# systemctl start AutoFS

[Email protected] ~]# Systemctl enable AutoFS

[Email protected] ~]# cd/net/172.25.254.1

[Email protected] 172.25.254.1]# Vim/etc/sysconfig/autofs

* * automatically mounts to custom directories

Vim/etc/auto.master

/westos /etc/auto.westos

Vim/etc/auto.westos

* 172.25.254.126:/nfshare/&

Redhat 172.25.254.126:/nfshare

Systemctl Restart AutoFS

Cd/westos

If there are errors, follow the error message. Frequently asked questions are problems with the RPC Service not starting, firewall not shutting down,selinux not shutting down, and so on.


This article is from the "Yuan Xiao Xiao" blog, please be sure to keep this source http://yuanxiaoguang.blog.51cto.com/11338250/1898237

NFS (Network File system-NET filesystem)

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.