Loading and using Linux NFS service

Source: Internet
Author: User

In some development systems, we usually use Linux systems. In Linux, how does one share and store network files? This issue involves the NFS service settings. Today, we will explain the specific configuration process of the Linux NFS service.

1. The system has installed the NFS package by default. If NFS is manually installed, five RPM packages are required.

Setup-*: the shared NFS directory is defined in/etc/exports.

Initscripts-*: includes the BASIC script for loading the network directory during the boot process.

Nfs-utils-*: includes basic NFS commands and monitoring programs.

Portmap-*: supports secure connections to the nfs rpc service.

2. edit/etc/exports and list the directories to be shared in the file. The writing rule is: one row for each sharing rule)

/Nfs * (rw, sync, no_wdelay, insecure_locks, no_root_squash)

Specific parameter explanation:

Rw: read/write permission;

Ro: Read-Only permission;

No_root_squash: if the user logging on to the NFS host is a ROOT user, he has the ROOT permission root_squash:

If the user logging on to the NFS host using the directory is root, this user's permission

Will be compressed into anonymous users. Generally, his UID and GID will become the nobody identity;

All_squash: No matter what users log on to the NFS host, they will be reset to nobody.

Anonuid: sets all users logging on to the NFS host to the specified user id, which must exist in/etc/passwd.

Anongid: Same as anonuid, but changed to group ID!

Sync: data is synchronized to the storage.

Async: The data is temporarily stored in the memory and not directly written to the hard disk.

Insecure allows unauthorized access from this machine.

3. exportfs command:

After NFS is started,/etc/exports is modified. to restart nfs, use the exportfs command to make the change take effect immediately,

The command format is as follows:

Exportfs [-aruv]

The parameter meanings are as follows:

-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.

Specific example: [root @ test/] # exportfs-rv <= all re-export once!

4. Start the Linux NFS service

# Service portmap start

# Service nfs start

Check the NFS running level:

# Chkconfig -- list portmap

# Chkconfig -- list nfs

Set automatic NFS startup at the appropriate running level as needed:

# Chkconfig -- level 235 portmap on

# Chkconfig -- level 235 nfs on

In addition, check whether the system's iptables,/etc/hosts. allow,/etc/hosts. deny have set correct NFS access rules.

Then.

5. Client Configuration

Run the following command on the client to MOUNT the Linux NFS service file system.

Mount-o bg, hard, nointr, rsize = 32768, wsize = 32768, proto = tcp, noac, nfsvers = 3 192.168.2.2:/nfs

/R

When the client is loaded

"Mount: mount to NFS server 'p470' failed: RPC Error: Program not registered." Error occurred.

.

Error cause: p470 Linux NFS service is interrupted due to network reasons, restart the Linux NFS service for p470-1 and then re-mount it on the client

[Root @ a nfs] # service nfs restart or/etc/rc. d/init. d/nfs restart

Ps-ef | grep nfs view service process

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.