Simple setup of NFS file system in Linux

Source: Internet
Author: User
Article Title: Simple setup of the NFS file system in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source. I. Concepts
  
NFS (Network File System/Network File System ):
  
1. Set file sharing between Linux systems (SAMBA service is used for file sharing between Linux and Windows );
  
2. NFS is only a file system. It has no transmission function and is implemented based on the RPC protocol to share the file directories between two Linux systems;
  
3. NFS is a C/S architecture;
  
    Ii. Server Configuration
  
1. Configuration File
  
The main configuration file is/etc/exports.
  
Format: mount the Host IP address in the shared directory (parameter 1, parameter 2 ,......)
  
For example:/var/nfs 172. 20. *. * (rw, sync, all_squash, anonuid = 65534, anongid = 65534)
  
Note: The nfs/directory access permission must be set to 777. The parent directory/var permission is not required. The normal 755 permission is required;
  
2. Start Related Services
  
Start related services in sequence: portmap, nfslock, and nfs.
  
3. Check the shared directory
  
Then you can use showmount? E. Check the shared directory:
  
[Root @ ns var] # showmount-e
  
Export list for ns. osserver:
  
/Var/nfs 172. 20 .*.*
  
OK. So far, the NFS server has been set up;
  
     3. Client Configuration
  

1. Ensure portmap operation
  
The client must ensure that the corresponding portmap of the RPC protocol runs normally; otherwise, the mount fails;
  
2. Mount the/var/nfs Directory (the local mount point is/mnt/nfs)
  
Mount-t nfs 172.20.65.16:/var/nfs/mnt/nfs
  
After the mount operation is successful, you can perform the same operations as the local directory;
  
     4. Other related commands
  
1. After the/etc/exports file is modified, you do not need to restart the nfs service to directly use exports? Rv can re-export the shared directory;
  
The command format is as follows:
  
Exportfs [-aruv]
  
-A: All content in mount or unmount/etc/exports
  
-R: Re-mount the directory shared in/etc/exports
  
-U: umount directory
  
-V: when the export is used, the detailed information is output to the screen.
  
Example:
  
[Root @ ns var] # showmount-e
  
Export list for ns. osserver:
  
/Var/nfs 172. 20 .*.*
  
[Root @ ns var] # exportfs? Au # Uninstall all
  
[Root @ ns var] # showmount-e
  
Export list for ns. osserver:
  
[Root @ ns var] # exportfs? Rv # Re-export all once
  
Exporting 172. 20. *. *:/var/nfs
  
[Root @ ns var] #
  
2. The showmout command is helpful for NFS operations and troubleshooting. Let's take a look at the usage of showmount.
  
Showmout
  
-A: this parameter is generally used on the nfs server and is used to display the cline machine that has mounted the local nfs directory.
  
-E: displays the export directory on the specified nfs server.
  
For example:
  
[Root @ localhost ~] # Showmount-e 172.20.65.16
  
Export list for 172.20.65.16:
  
/Var/nfs 172. 20 .*.*
  
[Root @ ns var] # showmount-
  
All mount points on ns. osserver:
  
172. 20. *. *:/var/nfs
  
     5. FAQs
  
1. Tip: mount to NFS server '2017. ipv67.203 'failed: server is down.
  
Solution: the NFS server firewall may be faulty;
  
2. Tip: mount: RPC: Timed out
  
Solution: Because the RPC protocol is not running, start the portmap service;
  
It may also be a firewall problem; Server/Client may also be.
  

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.