How to configure Server for NFS under Linux

Source: Internet
Author: User
Keywords Linux nfs
The network filesystem (nfs,network file system) is a mechanism by which partitions (directories) on a remote host are mounted over the network to the local system, which enables users to share partitions (directories) on the remote host, as if they were operating on the local system, by supporting the network file system. . In the development of embedded Linux, developers need to do all the software development on the Linux server, cross compile, the general FTP way to download the executable file to the embedded system, but this method not only inefficient, and can not achieve online debugging. So, by building NFS, The specific partition on the Linux server is shared to the embedded target system to be debugged, and the Linux server can be operated directly on the embedded target system, and the program can be debugged and modified online, which greatly facilitates the development of software. Therefore, NFS is embedded Linux An important part of development, this section details how to configure the NFS development environment for Embedded Linux. The implementation of the NFS development environment of embedded Linux includes two aspects: one is the server Server for NFS servers, and the other is the support of the NFS client of the embedded target system. Therefore, the establishment of an NFS development environment requires configuring the Linux server side and the embedded target system side. NFS was developed and developed by sun to share individual files across the network between different machines and different operating systems. NFS server can also be viewed as a file SERVER that is used to share files between Unix class systems, easily mount (mount) to a directory, and operate as conveniently as local files. Type: System v-launched Service Package: Nfs-utils process: Nfsd,lockd,rpciod,rpc. {mounted,rquotad,statd} script: Nfs,nfslock port: Assigned port by Portmap Service (111) Profile:/etc/exports accessibility: Portmap (MUST) related commands: Rpcinfo-p [ Ipadd]: View server-provided RPC services SHOWMOUNT-E: View the directory server side of the service share: 1./etc/exports format: Directory Options example: Share/share directory to 192.168.0.x users/share 192.168.0.0/24 (rw)/home/haiouc/haioucshare * (Rw,sync,all_squash) mnt 192.168.0.* (RO) ====>* refers to allowing all IP access, to the directory/home/haiouc/haioucshare to give certain permissions; You can load the local disc, and then share it with NFS 2. Start Portmap Services: Service Portmap start[ Restart]3. Start NFS Service: Service NFS Start[restart]client end: 1. Start the Portmap services: Service Portmap start[restart]2. Mount the shared directory on the server side ( Assume server-side 192.168.0.1): Mkdir/mnt/localsharemount-t NFS 192.168.0.1:/share/mnt/localshare============================ =============================================showmount//Display information about Server for NFS file system mount SHOWMOUNT-E//Display output List of Server for NFS ========= ================================================================chkconfig--level NFS on//Set NFS automatic startup mode; ========= ================================================================ can automatically mount NFS directories by modifying fstab files [root@server6 nfs1]# cat/etc/fstab# This file was edited by Fstab-sync-see ' Mans Fstab-sync ' for detailslabel=//ext3 defaults 1 1none /dev/pts devpts gid=5,mode=620 0 0none/dev/shm tmpfs defaults 0 0none/proc proc defaults 0 0none/sys sysfs defaults 0 0LABEL=SWAP-HDC2 Swap defaults 0 0192.168.1.10:/HOME/HAIOUC/HAIOUCSHARE/MNT/NFS1 NFS Defaults 0 0=========================================================================NFS parameter information: access rights option. Set output directory Read only ro. Set output directory read RW user mapping option. All_squash maps all normal users and groups belonging to remote access to anonymous users or groups of users (Nfsnobody);. No_all_squash with All_squash (default setting);. Root_squash maps root and group to anonymous users or groups of users (default setting);. No_root_squash and Rootsquash; Anonuid=xxx maps all users of remote access to anonymous users and specifies that the user is a local user (uid=xxx);. Anongid=xxx maps all user groups for remote access to anonymous user group accounts and specifies that the anonymous user group account is a local user group account (GID=XXX), and other options. Secure limits clients can only connect to NFS servers from TCP/IP ports less than 1024 (default settings);. Insecure allows clients to connect to the server from TCP/IP ports greater than 1024;. Sync writes data synchronously to memory buffers and disks, which is inefficient, but can ensure data consistency. Async the data to the memory buffer before it is written to disk, if necessary. Wdelay checks for related writes and, if so, executes them together, which can improve efficiency (default settings);. No_wdelay If there is a write operation will be implemented immediately, should be used in conjunction with the sync; Subtree If the output directory is a subdirectory, the NFS server checks the permissions of its parent directory (the default setting);. No_subtree even if the output directory is a subdirectory, NFS server does not check the permissions of its parent directory, which can improve efficiency;
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.