NFS Shared Services Build

Source: Internet
Author: User

1. Configuration of Linux server-side NFS servers

Log on to the Linux server as root, edit the shared directory profile exports in the/etc directory, specify the shared directory and permissions, and so on.

Execute the following command to edit the file/etc/exports:

# Vi/etc/exports

Add the following to the file:

/home/work 192.168.0.* (Rw,sync,no_root_squash)

Then save the exit.

Added content representation: Allows the IP address range on the 192.168.0.* computer to access the/home/work directory with read and write permissions.

/home/work is also known as the server output shared directory.

The meaning of the parameters in parentheses is described below:

RW: Read/write permissions, read-only access to the parameters of the RO;

Sync: Data is written to memory and hard disk, and async is used, where data is staged in memory and not immediately written to the hard disk.

The NO_ROOT_SQUASH:NFS server shares the user's attributes, and if the user is root, it has root permissions for the shared directory.

Then execute the following command to start the port mapping:

#/etc/rc.d/init.d/portmap Start ( Portmap has been changed to Rpcbind in centos6.5)

Finally execute the following command to start the NFS service, at which time NFS activates the daemon and then starts listening on the client side of the request:

#/etc/rc.d/init.d/nfs Start

Users can also restart the Linux server and automatically start the NFS service.

After the NFS server is started, it is also necessary to check the firewall settings of the Linux server (typically shutting down the Firewall service), to ensure that the port used for NFS is not blocked and the host that allows communication, mainly to check the settings of options such as Linux server Iptables,ipchains, and/ Etc/hosts.deny,/etc/hosts.allow file.

We first perform a loopback test of the NFS server on the Linux server to verify that the shared directory is accessible. Run the following command on the Linux server:

# mount–t NFS 192.168.0.20:/home/work/mnt

# ls/mnt

command to mount the NFS output shared directory of a Linux server to the/MNT directory, so if NFS is working properly, you should be able to see the contents of the/home/work shared directory in the/MNT directory.

2. Client Configuration

Under the Linux shell of the target system, execute the following command to mount the NFS shared directory:

# MKDIR/MNT/NFS//Build a Linux server output shared directory mount point;

# mount–t NFS 192.168.0.20:/home/work/mnt/nfs–o Nolock

# Cd/mnt/nfs

# ls

At this point, the embedded target system will display the contents of the Linux server output directory, that is, the output of the Linux server.

/home/work is mapped to the/mnt/nfs directory of the embedded target system via NFS. The user can verify the actual effect by adding/deleting/modifying the file. The 192.168.0.20 in the Mount command is the IP address of the Linux server,/home/work is the shared output directory configured on the Linux server side, and/mnt/nfs is the local directory on the embedded device.

During the development process, it was annoying to enter commands back and forth, and I wrote two simple scripts to complete the NFS boot and mount.

Host to start NFS:

SNFs

#!/bin/bash

Ifconfig eth0 192.168.0.20

/etc/rc.d/init.d/portmap start

/etc/rc.d/init.d/nfs start

Embedded Target Mount NFS:

Mnfs:

#!/bin/sh

Mount-t NFS 192.168.0.20:/home/work/nfs/mnt/nfs-o Nolock

echo "NFS ok! ”



NFS Shared Services Build

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.