How Linux Mounts file systems using NFS

Source: Internet
Author: User

Device: A server and a client, here we put the Redhat installed on the PC as a server, and the client is embedded Linux Development Board.

Environment: The Development Board has been started, connect the serial and network cable, serial port for issuing command control Development Board, network cable is used for NFS

1. Confirm that Redhat has installed the NFS package and entered it in the terminal

[Email protected] examples]# rpm-q nfs-utils
Nfs-utils-1.0.9-24.el5
If the results above indicate that NFS is already installed, then install the Nfs-utils package first.

2. Configure Server for NFS

[Email protected] examples]# Vi/etc/exports
After opening the configuration file, it is generally empty, write it yourself, write the following configuration information:

/home/example/rootfs 192.168.2.* (Rw,sync,no_root_squash)

Analytical:

/home/example/rootfs--Shared folder path

192.168.2.*---Allow access to the IP number, of course, you can specify a specific, such as 192.168.2.11

(Rw,sync,no_root_squash)--permissions, etc., the meaning of the specific parameters can be Baidu

So the configuration information is still relatively simple.

3. Start/restart Server for NFS

You can use the restart command, regardless of whether NFS has been started beforehand, as follows:

[Email protected] examples]#/etc/init.d/nfs restart

OK, this server-side configuration is complete, and then used on the client Development Board, the so-called Mount file system.

Before you mount, verify that the network is up and down. Connect the network cable, and make sure that the networks are working with the ping command, for example, the server IP is set to 192.168.2.22, the Development Board IP is set to 192.168.2.11.

Both subnet masks are 255.255.255.0, so you can see the response on the board by pinging the 192.168.2.22 command.

4. Mount File System

Create a new NFS folder under the MNT folder on the Development Board to map shared folders on the server, and of course you can build them elsewhere, as long as the command is correct and commands are as follows:
Mount-t NFS 192.168.2.22:/home/example/rootfs/mnt/nfs

Analytical:

Mount-t NFS-to-mount command, which represents the folder on which NFS shares are mounted

192.168.2.22:/HOME/EXAMPLE/ROOTFS--server-side shared folder path in the Format ip:/shared folder path

/mnt/nfs--Maps to a local folder, that is, a folder on the client Development Board.

Note: If you enter a command with the following error "svc:failed to register LOCKDV1 RPC service (errno 111)", use the following command instead:

Mount-t Nfs-o nolock 192.168.2.22:/home/example/rootfs/mnt/nfs

5, Mount complete, use

After the mount is complete, the server-side operation on the shared folder can be seen in the folder mapped in the client.

Exa.

Copy a file to the server shared folder, [[email protected] examples]# CP test.c rootfs/

Then on the client can see also, on the client command: [[email protected] led]# cd/mnt/nfs/
[[email protected] nfs]# ls

TEST.c

OK, at this point mounted, is actually shared through NFS a folder.

Reference articles

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.