Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nfs Network File system-- Learning Notes

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The environment of this experiment is redhat 7.0system.

The nfs service can mount the file sharing resources on the remote linux server to the local linux host, and the local linux host can manipulate the remote shared directory files just like using local directory files based on the TCP/IP protocol.

1. Server 1.1 install [root@localhost Desktop] # yum install nfs-utils-y # close iptables [root@localhost Desktop] # iptables-F [root@localhost Desktop] # system ^ C [root@localhost Desktop] # service iptables saveiptables: Saving firewall rules to / etc/sysconfig/iptables: [OK] 1.2 create a shared directory [root@localhost Desktop] # mkdir / nfsdir# ensure that the shared directory has permissions, and others can read and write [root@localhost Desktop] # chmod-Rf 777 / nfsdir1.3 to configure nfs

Main configuration file / etc/exports

Format: the path to the shared directory allows access to the nfs client IP (share permission parameter), and there is no space between the nfs client IP and permissions.

Parameters for permissions:

Parameter function ro read-only rw read-write root_squash when the nfs client is accessed by the root administrator, the anonymous user no_root_squash Fang nfs client mapped as the nfs server is accessed by the root administrator, the root administrator all_saquash mapped to the nfs server, no matter what account the nfs client uses, is mapped to the anonymous user sync of the nfs server to write data to memory and hard disk at the same time Make sure that the data is not lost. Async gives priority to saving the data to memory and then writing it to the hard disk. This is efficient, but there is data that can be lost [root@localhost Desktop] # vim / etc/exports/nfsdir 192.168.137.* (rw,sync,root_squash) 1.4.Boot # launch RPC Nfs needs to launch NFS [root @ localhost Desktop] # systemctl restart nfs-server [root@localhost Desktop] # systemctl enable nfs-serverln-s'/ usr/lib/systemd/system/nfs-server.service''/ etc/systemd/system/nfs.target.wants/nfs-server.service'2 using the RPC service [root@localhost Desktop] # systemctl restart rpcbind.service [root] # systemctl enable rpcbind.service #. Client 2.1 installs the nfs-utils tool [root@localhost ~] # yum install nfs-utils-y2.2 to query server sharing information

Parameters of the showmount command

Parameter function-e displays the shared list of nfs servers-a displays local mounted fns resources [root@localhost ~] # showmount-e 192.168.137.10Export list for 192.168.137.10:/nfsdir 192.168.137.02.3 Mount [root@localhost ~] # mkdir / nfsdir [root@localhost ~] # mount-t nfs 192.168.137.10:/nfsdir / nfsdir [root@localhost ~] # df-ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/rhel-root xfs 18G 3.0G 15G 17% / devtmpfs devtmpfs 985M 0985m 0% / devtmpfs tmpfs 994M 140K 994m 1% / dev/shmtmpfs tmpfs 994M 8.9m 986m 1% / runtmpfs tmpfs 994M 0994m 0% / sys/fs/ Cgroup/dev/sda1 xfs 497M 112M 385M 23% / boot/dev/sr0 iso9660 3.5G 3.5G 0100% / media/cdrom192.168.137.10:/nfsdir nfs4 18G 3.0G 15G 17% / nfsdir

The test succeeded

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report