Linux NFS服务 服务端

[[email protected] /]# cat /etc/redhat-release       #########查看系统

CentOS release 6.5 (Final)

[[email protected] /]# uname -m                      #########查看系统是32位还是64位。这里是64位

x86_64

[[email protected] /]# uname -r                      #########查看内核版本

2.6.32-431.el6.x86_64

[[email protected] /]# rpm -aq nfs-utils portmap rpcbind    #########检查系统是否安装nfs portmap rpcbind

[[email protected] /]# yum grouplist                 #########查看可能批量安装哪些列表。扩展:yum grouplist 列出所有可安装的软件包

Loaded plugins: fastestmirror, security

Setting up Group Process

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* extras: mirrors.163.com

* updates: mirrors.163.com

base                                | 3.7 kB     00:05

http://mirrors.163.com/centos/6.8/extras/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.163.com/centos/6.8/extras/x86_64/repodata/repomd.xml: (28, ‘Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds‘)

Trying other mirror.

extras                              | 3.4 kB     00:00

extras/primary_db                   |  37 kB     00:00

updates                             | 3.4 kB     00:00

updates/primary_db                  | 748 kB     00:00

base/group_gz                       | 226 kB     00:00

Installed Groups:

Base

Compatibility libraries

Debugging Tools

Development tools

Dial-up Networking Support

E-mail server

Fonts

Graphical Administration Tools

Hardware monitoring utilities

Legacy UNIX compatibility

Networking Tools

Performance Tools

Perl Support

Scientific support

Security Tools

Web Server

Installed Language Groups:

Arabic Support [ar]

Armenian Support [hy]

Georgian Support [ka]

Hebrew Support [he]

Inuktitut Support [iu]

Lao Support [lo]

Tajik Support [tg]

Available Groups:

Additional Development

Backup Client

Backup Server

CIFS file server

Client management tools

Console internet tools

Desktop

Desktop Debugging and Performance Tools

Desktop Platform

Desktop Platform Development

Directory Client

Directory Server

Eclipse

Emacs

FCoE Storage Client

FTP server

General Purpose Desktop

Graphics Creation Tools

Guest Agents

High Availability

High Availability Management

Identity Management Server

Infiniband Support

Input Methods

Internet Applications

Internet Browser

Java Platform

KDE Desktop

Large Systems Performance

Legacy X Window System compatibility

Load Balancer

Mainframe Access

Messaging Client Support

MySQL Database client

MySQL Database server

NFS file server

Network Infrastructure Server

Network Storage Server

Network file system client

Office Suite and Productivity

PHP Support

PostgreSQL Database client

PostgreSQL Database server

Print Server

Printing client

Remote Desktop Clients

Resilient Storage

Ruby Support

SNMP Support

Scalable Filesystems

Server Platform

Server Platform Development

Smart card support

Storage Availability Tools

System Management

System administration tools

TeX support

Technical Writing

TurboGears application framework

Virtualization

Virtualization Client

Virtualization Platform

Virtualization Tools

Web Servlet Engine

Web-Based Enterprise Management

X Window System

iSCSI Storage Client

Available Language Groups:

Afrikaans Support [af]

Albanian Support [sq]

Amazigh Support [ber]

Assamese Support [as]

Azerbaijani Support [az]

Basque Support [eu]

Belarusian Support [be]

Bengali Support [bn]

Bhutanese Support [dz]

Brazilian Portuguese Support [pt_BR]

Breton Support [br]

Bulgarian Support [bg]

Catalan Support [ca]

Chhattisgarhi Support [hne]

Chichewa Support [ny]

Chinese Support [zh]

Coptic Support [cop]

Croatian Support [hr]

Czech Support [cs]

Danish Support [da]

Dutch Support [nl]

English (UK) Support [en_GB]

Esperanto Support [eo]

Estonian Support [et]

Ethiopic Support [am]

Faroese Support [fo]

Fijian Support [fj]

Filipino Support [fil]

Finnish Support [fi]

French Support [fr]

Frisian Support [fy]

Friulian Support [fur]

Gaelic Support [gd]

Galician Support [gl]

German Support [de]

Greek Support [el]

Gujarati Support [gu]

Hiligaynon Support [hil]

Hindi Support [hi]

Hungarian Support [hu]

Icelandic Support [is]

Indonesian Support [id]

Interlingua Support [ia]

Irish Support [ga]

Italian Support [it]

Japanese Support [ja]

Kannada Support [kn]

Kashmiri Support [ks]

Kashubian Support [csb]

Kazakh Support [kk]

Khmer Support [km]

Kinyarwanda Support [rw]

Konkani Support [kok]

Korean Support [ko]

Kurdish Support [ku]

Latin Support [la]

Latvian Support [lv]

Lithuanian Support [lt]

Low Saxon Support [nds]

Luxembourgish Support [lb]

Macedonian Support [mk]

Maithili Support [mai]

Malagasy Support [mg]

Malay Support [ms]

Malayalam Support [ml]

Maltese Support [mt]

Manx Support [gv]

Maori Support [mi]

Marathi Support [mr]

Mongolian Support [mn]

Myanmar (Burmese) Support [my]

Nepali Support [ne]

Northern Sotho Support [nso]

Norwegian Support [nb]

Occitan Support [oc]

Oriya Support [or]

Persian Support [fa]

Polish Support [pl]

Portuguese Support [pt]

Punjabi Support [pa]

Romanian Support [ro]

Russian Support [ru]

Sanskrit Support [sa]

Sardinian Support [sc]

Serbian Support [sr]

Sindhi Support [sd]

Sinhala Support [si]

Slovak Support [sk]

Slovenian Support [sl]

Somali Support [so]

Southern Ndebele Support [nr]

Southern Sotho Support [st]

Spanish Support [es]

Swahili Support [sw]

Swati Support [ss]

Swedish Support [sv]

Tagalog Support [tl]

Tamil Support [ta]

Telugu Support [te]

Tetum Support [tet]

Thai Support [th]

Tibetan Support [bo]

Tsonga Support [ts]

Tswana Support [tn]

Turkish Support [tr]

Turkmen Support [tk]

Ukrainian Support [uk]

Upper Sorbian Support [hsb]

Urdu Support [ur]

Uzbek Support [uz]

Venda Support [ve]

Vietnamese Support [vi]

Walloon Support [wa]

Welsh Support [cy]

Xhosa Support [xh]

Zulu Support [zu]

Done

[[email protected] /]# yum groupinstall "NFS file server" -y

#########安装NFS。

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* extras: mirrors.163.com

* updates: mirrors.163.com

Setting up Group Process

Checking for new repos for mirrors

Resolving Dependencies

--> Running transaction check

---> Package nfs-utils.x86_64 1:1.2.3-70.el6 will be installed

--> Processing Dependency: nfs-utils-lib >= 1.1.0-3 for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libtirpc >= 0.2.1-11 for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: keyutils >= 1.4-4 for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: python-argparse for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libgssglue.so.1(libgssapi_CITI_2)(64bit) for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libgssglue for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libevent for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libgssglue.so.1()(64bit) for package: 1:nfs-utils-1.2.3-70.el6.x86_64

--> Processing Dependency: libevent-1.4.so.2()(64bit) for package: 1:nfs-utils-1.2.3-70.el6.x86_64

---> Package nfs4-acl-tools.x86_64 0:0.3.3-8.el6 will be installed

--> Running transaction check

---> Package keyutils.x86_64 0:1.4-5.el6 will be installed

--> Processing Dependency: keyutils-libs = 1.4-5.el6 for package: keyutils-1.4-5.el6.x86_64

---> Package libevent.x86_64 0:1.4.13-4.el6 will be installed

---> Package libgssglue.x86_64 0:0.1-11.el6 will be installed

---> Package libtirpc.x86_64 0:0.2.1-11.el6 will be installed

---> Package nfs-utils-lib.x86_64 0:1.1.5-11.el6 will be installed

---> Package python-argparse.noarch 0:1.2.1-2.1.el6 will be installed

---> Package rpcbind.x86_64 0:0.2.0-12.el6 will be installed

--> Running transaction check

---> Package keyutils-libs.x86_64 0:1.4-4.el6 will be updated

---> Package keyutils-libs.x86_64 0:1.4-5.el6 will be an update

--> Finished Dependency Resolution

Dependencies Resolved

===========================================================

Package           Arch     Version           Repository

Size

===========================================================

Installing:

nfs-utils         x86_64   1:1.2.3-70.el6    base   334 k

nfs4-acl-tools    x86_64   0.3.3-8.el6       base    43 k

Installing for dependencies:

keyutils          x86_64   1.4-5.el6         base    39 k

libevent          x86_64   1.4.13-4.el6      base    66 k

libgssglue        x86_64   0.1-11.el6        base    23 k

libtirpc          x86_64   0.2.1-11.el6      base    82 k

nfs-utils-lib     x86_64   1.1.5-11.el6      base    68 k

python-argparse   noarch   1.2.1-2.1.el6     base    48 k

rpcbind           x86_64   0.2.0-12.el6      base    51 k

Updating for dependencies:

keyutils-libs     x86_64   1.4-5.el6         base    20 k

Transaction Summary

===========================================================

Install       9 Package(s)

Upgrade       1 Package(s)

Total download size: 774 k

Downloading Packages:

(1/10): keyutils-1.4-5.el6.x86_64.r |  39 kB     00:00

(2/10): keyutils-libs-1.4-5.el6.x86 |  20 kB     00:00

(3/10): libevent-1.4.13-4.el6.x86_6 |  66 kB     00:00

(4/10): libgssglue-0.1-11.el6.x86_6 |  23 kB     00:00

(5/10): libtirpc-0.2.1-11.el6.x86_6 |  82 kB     00:00

(6/10): nfs-utils-1.2.3-70.el6.x86_ | 334 kB     00:00

(7/10): nfs-utils-lib-1.1.5-11.el6. |  68 kB     00:00

(8/10): nfs4-acl-tools-0.3.3-8.el6. |  43 kB     00:00

(9/10): python-argparse-1.2.1-2.1.e |  48 kB     00:00

(10/10): rpcbind-0.2.0-12.el6.x86_6 |  51 kB     00:00

-----------------------------------------------------------

Total                      184 kB/s | 774 kB     00:04

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : libgssglue-0.1-11.el6.x86_64           1/11

Installing : libtirpc-0.2.1-11.el6.x86_64           2/11

Updating   : keyutils-libs-1.4-5.el6.x86_64         3/11

Installing : keyutils-1.4-5.el6.x86_64              4/11

Installing : rpcbind-0.2.0-12.el6.x86_64            5/11

Installing : python-argparse-1.2.1-2.1.el6.noarc    6/11

Installing : libevent-1.4.13-4.el6.x86_64           7/11

Installing : nfs-utils-lib-1.1.5-11.el6.x86_64      8/11

Installing : 1:nfs-utils-1.2.3-70.el6.x86_64        9/11

Installing : nfs4-acl-tools-0.3.3-8.el6.x86_64     10/11

Cleanup    : keyutils-libs-1.4-4.el6.x86_64        11/11

Verifying  : keyutils-libs-1.4-5.el6.x86_64         1/11

Verifying  : libevent-1.4.13-4.el6.x86_64           2/11

Verifying  : 1:nfs-utils-1.2.3-70.el6.x86_64        3/11

Verifying  : keyutils-1.4-5.el6.x86_64              4/11

Verifying  : rpcbind-0.2.0-12.el6.x86_64            5/11

Verifying  : nfs-utils-lib-1.1.5-11.el6.x86_64      6/11

Verifying  : libgssglue-0.1-11.el6.x86_64           7/11

Verifying  : nfs4-acl-tools-0.3.3-8.el6.x86_64      8/11

Verifying  : libtirpc-0.2.1-11.el6.x86_64           9/11

Verifying  : python-argparse-1.2.1-2.1.el6.noarc   10/11

Verifying  : keyutils-libs-1.4-4.el6.x86_64        11/11

Installed:

nfs-utils.x86_64 1:1.2.3-70.el6

nfs4-acl-tools.x86_64 0:0.3.3-8.el6

Dependency Installed:

keyutils.x86_64 0:1.4-5.el6

libevent.x86_64 0:1.4.13-4.el6

libgssglue.x86_64 0:0.1-11.el6

libtirpc.x86_64 0:0.2.1-11.el6

nfs-utils-lib.x86_64 0:1.1.5-11.el6

python-argparse.noarch 0:1.2.1-2.1.el6

rpcbind.x86_64 0:0.2.0-12.el6

Dependency Updated:

keyutils-libs.x86_64 0:1.4-5.el6

Complete!

[[email protected] /]# rpm -aq nfs-utils portmap rpcbind

rpcbind-0.2.0-12.el6.x86_64

nfs-utils-1.2.3-70.el6.x86_64

[[email protected] /]# /etc/init.d/rpcbind start

Starting rpcbind:                                         [  OK  ]

[[email protected] /]# ps -ef|grep rpc

rpc       2802     1  0 08:35 ?        00:00:00 rpcbind

root      2806  1490  0 08:36 pts/0    00:00:00 grep --color=auto rpc

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# /etc/init.d/rpcbind  status

rpcbind (pid  2802) is running...

[[email protected] /]# rpcinfo -p localhost(本机的地址)     ####查看中介有没有房源(形象的比方) ,就是查看本机有没有房源

program vers proto   port  service

100000    4   tcp    111  portmapper

100000    3   tcp    111  portmapper

100000    2   tcp    111  portmapper

100000    4   udp    111  portmapper

100000    3   udp    111  portmapper

100000    2   udp    111  portmapper    ####综上都没房源。对外用111端口

[[email protected] /]# /etc/init.d/rpcbind  stop

Stopping rpcbind:                                         [  OK  ]

[[email protected] /]# rpcinfo -p localhost

rpcinfo: can‘t contact portmapper: RPC: Remote system error - Connection refused               #######rpc服务没有开。主机这个报错==>>这是自己测试

[[email protected] /]# /etc/init.d/rpcbind  start

Starting rpcbind:                                          [  OK  ]

[[email protected] /]# rpcinfo -p localhost

program vers proto   port  service

100000    4   tcp    111  portmapper

100000    3   tcp    111  portmapper

100000    2   tcp    111  portmapper

100000    4   udp    111  portmapper

100000    3   udp    111  portmapper

100000    2   udp    111  portmapper

[[email protected] /]# /etc/init.d/nfs start           启动nfs服务

Starting NFS services:                                     [  OK  ]

Starting NFS quotas:                                       [  OK  ]

Starting NFS mountd:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting RPC idmapd:                                       [  OK  ]

[[email protected] /]# rpcinfo -p localhost       #####启动rpc服务之后出现端口

program vers proto   port  service

100000    4   tcp    111  portmapper

100000    3   tcp    111  portmapper

100000    2   tcp    111  portmapper

100000    4   udp    111  portmapper

100000    3   udp    111  portmapper

100000    2   udp    111  portmapper

100011    1   udp    875  rquotad

100011    2   udp    875  rquotad

100011    1   tcp    875  rquotad

100011    2   tcp    875  rquotad

100005    1   udp  48811  mountd

100005    1   tcp  46451  mountd

100005    2   udp  50017  mountd

100005    2   tcp  59534  mountd

100005    3   udp  52072  mountd

100005    3   tcp  43258  mountd

100003    2   tcp   2049  nfs

100003    3   tcp   2049  nfs

100003    4   tcp   2049  nfs

100227    2   tcp   2049  nfs_acl

100227    3   tcp   2049  nfs_acl

100003    2   udp   2049  nfs

100003    3   udp   2049  nfs

100003    4   udp   2049  nfs

100227    2   udp   2049  nfs_acl

100227    3   udp   2049  nfs_acl

100021    1   udp  48251  nlockmgr

100021    3   udp  48251  nlockmgr

100021    4   udp  48251  nlockmgr

100021    1   tcp  34676  nlockmgr

100021    3   tcp  34676  nlockmgr

100021    4   tcp  34676  nlockmgr

[[email protected] /]# chkconfig nfs on         ###自启动

[[email protected] /]# chkconfig rpcbind on

[[email protected] /]# chkconfig --list nfs      ###检查

nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off

[[email protected] /]# chkconfig --list rpcbind  ###检查

rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off

[[email protected] /]# more /etc/init.d/nfs         ###看脚本,主要看rpc和nfs服务启停的时间

#!/bin/sh

#

# nfs           This shell script takes care of starting and stopping

#               the NFS services.

#

#

# description: NFS is a popular protocol for file sharing across networks.

#              This service provides NFS server functionality, which is \

#              configured via the /etc/exports file.

# probe: true

# config: /etc/sysconfig/nfs

### BEGIN INIT INFO

# Provides: nfs

# Required-Start: $local_fs $network $syslog $rpcbind

[[email protected] /]# more /etc/init.d/rcpbind

/etc/init.d/rcpbind: No such file or directory

[[email protected] /]# more /etc/init.d/rpcbind

#! /bin/sh

#

# rpcbind       Start/Stop RPCbind

#

# chkconfig: 2345 13 87

# description: The rpcbind utility is a server that converts RPC program \

#              numbers into universal addresses. It must be running on the

\

#              host to be able to make RPC calls on a server on that machi

ne.

#

# processname: rpcbind

# probe: true

# config: /etc/sysconfig/rpcbind

# This is an interactive program, we need the current locale

[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh

# We can‘t Japanese on normal console at boot time, so force LANG=C.

if [ "$LANG" = "ja" -o "$LANG" = "ja_JP.eucJP" ]; then

[[email protected] /]# ll /etc/exports      ### nfs 的配置文件

-rw-r--r--. 1 root root 0 Jan 12  2010 /etc/exports

[[email protected] /]# cat  /etc/exports    ### 配置文件默认为空

[[email protected] /]# mkdir /data   ###创建共享目录

mkdir: cannot create directory `/data‘: File exists    ###已经存在

[[email protected] /]# ll /data/

total 16

-rw-r--r--. 1 root root 111 Jun 20 06:54 html_2016-06-20.tar.gz

-rw-r--r--. 1 root root 156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 root root 156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 root root 111 Jun 24 07:20 www_bak_5.tar.ga

[[email protected] /]# vim /etc/exports

#shared data for bbs by zhang at 2016627   == >>不要忘记写注释

/data 10.0.0.0/24(rw,sync)             ###r读 w写 ro只读

~                                             sync是写到磁盘,如果是async那就是写到缓存

~

"/etc/exports" 2L, 68C written

[[email protected] /]# cat /etc/exports

#shared data for bbs by zhang at 2016627

/data 10.0.0.0/24(rw,sync)

[[email protected] /]# /etc/init.d/nfs reload(别用restart重启,要用此:平滑重启)    #####重启服务

[[email protected] /]# vim/etc/init.d/nfs   ==>>nfs的脚本,进去/reload.

#!/bin/sh

#

# nfs           This shell script takes care of starting and stopping

#               the NFS services.

#

# chkconfig: - 30 60

# description: NFS is a popular protocol for file sharing across netw

orks.

#              This service provides NFS server functionality, which

is \

#              configured via the /etc/exports file.

# probe: true

# config: /etc/sysconfig/nfs

### BEGIN INIT INFO

# Provides: nfs

# Required-Start: $local_fs $network $syslog $rpcbind

# Required-Stop: $local_fs $network $syslog $rpcbind

:/res

rval=$?

[ $RETVAL -eq 0 ] && RETVAL=$rval

if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then

status rpc.rquotad

rval=$?

[ $RETVAL -eq 0 ] && RETVAL=$rval

fi

;;

restart)

$0 stop

$0 start

;;

reload | force-reload)

/usr/sbin/exportfs -r

[ -f /var/lock/subsys/nfs ] && touch /var/lock/subsys/nfs

;;

probe)

if [ ! -f /var/lock/subsys/nfs ] ; then

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# /etc/init.d/nfs reload == exportfs -r    ###可以认为等价

[[email protected] /]# showmount -e localhost               ########先在本机检查,然后客户端检查。-e:显示NFS服务器的输出清单

Export list for localhost:

/data 10.0.0.0/24

[[email protected] /]#

=======================================================

接下来就是分别server和client上测试:

[[email protected] /]# cd /data

[[email protected] data]# ll

total 16

-rw-r--r--. 1 nfsnobody root 111 Jun 20 06:54 html_2016-06-20.tar.gz

-rw-r--r--. 1 nfsnobody root 156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 nfsnobody root 156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 nfsnobody root 111 Jun 24 07:20 www_bak_5.tar.ga

[[email protected] data]# rm html_2016-06-20.tar.gz

rm: remove regular file `html_2016-06-20.tar.gz‘? y

[[email protected] data]# ll

total 12

-rw-r--r--. 1 nfsnobody nfsnobody   0 Jun 26 01:00 ddd

-rw-r--r--. 1 nfsnobody root      156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 nfsnobody root      156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 nfsnobody root      111 Jun 24 07:20 www_bak_5.tar.ga

[[email protected] data]#

========================================================

遇到的问题总结:

1.

[[email protected] /]# showmount -e localhost

clnt_create: RPC: Program not registered

解决方法:

由于网络原因nfs服务被中断,重新开启nfs服务然后在客户端重新mount

service nfs restart 或 /etc/rc.d/init.d/nfs restart

2.有关NFS客服端开机自启动挂载:a b:

a:

[[email protected] data]# which mount

/bin/mount

vi /etc/rc.local

/bin/mount -t nfs 192.168.21.128:/data /nfsdir/     ***用全路径吧。

***这种挂载方式不会影响系统开机

b:

vi  /etc/fstab

你现在可以动手测试。反正我的测试结果是挂载不了,且总结为:不要在 /etc/fstab中配置网络文件系统,本地的文件系统是可以的:fstab启动优先于网络。

3.查看挂载信息:

a.grep data(挂载目录)/proc/mounts

b.mount /proc/mounts

4.

[[email protected] mnt]# mount -t nfs 192.168.21.128:/date /mnt

mount.nfs: access denied by server while mounting 192.168.21.128:/date

仔细检查server端口:/etc/exports

5.

[[email protected] nfsdir]# showmount -e 192.168.21.128

clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)

解决:

[[email protected] data]# /etc/init.d/nfs status

rpc.svcgssd is stopped

rpc.mountd (pid 3026) is running...

nfsd (pid 3041 3040 3039 3038 3037 3036 3035 3034) is running...

rpc.rquotad (pid 3022) is running...

[[email protected] data]# /etc/init.d/rpcbind status

rpcbind (pid  3123) is running...

[[email protected] data]# rpc.mountd          ####关键于此

[[email protected] data]# showmount -e

Export list for localhost:

/data 192.168.21.131/24

[[email protected] nfsdir]# showmount -e 192.168.21.128

Export list for 192.168.21.128:

/data 192.168.21.131/24

6.防火墙开启导致

[[email protected] nfsdir]# showmount -e 192.168.21.128

clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

解决:

[[email protected] data]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:

[[email protected] nfsdir]# showmount -e 192.168.21.128

Export list for 192.168.21.128:

/data 192.168.21.131/24

7.[[email protected] mnt]# mount -t nfs -o nosuid,rw  192.168.21.128:/data /mnt

mount.nfs: Stale file handle

解决:1.是由于server端共享的目录在共享期间做出了移动目录,又创建了同名字的目录导致的,即在共享期间对该共享目录进行了移除操作,只需要在客户端重新挂下就OK 。2.mount -a:把所有的分区挂载信息重新mount 一边,之后在查看nfs分区挂载正常。

8..exportfs:

1)exportfs -rv =/etc/init.d/nfs reload

2)举例:

[[email protected] data]# exportfs -o sync,rw 192.168.21.0/24:/d==不用重启nfs

不用vi /etc/exports 要重启,是修改的配置生效。

============================================================

时间: 2024-10-11 02:20:25

Linux NFS服务 服务端的相关文章

Linux网络服务12——NFS共享服务

Linux网络服务12--NFS共享服务 一.NFS简介 端口号:TCP.UDP 111端口 NFS(Network File System)网络文件系统,是一种基于TCP/IP传输的网络文件系统协议,最初由SUM公司开发.通过使用NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源. NFS没有用户认证机制,而且数据在网络上明文传输,所以安全性很差,一般只能在局域网中使用.NFS服务的实现依赖于RPC(Remote Process Call)远程过程调用机制,以完成远程到本地的映

Linux NFS 服务部署

系统环境:Oracle Linux 5.7 服务端:192.168.1.111 客户端:192.168.1.171 一.服务端配置 1.依次启动portmap和nfs服务 service portmap start service nfs start [[email protected] ~]# service portmap status portmap (pid 2543) is running... [[email protected]-ASM ~]# service nfs status

Linux网络文件共享服务之NFS

一.NFS服务简介 NFS全称network file system 网络文件系统,基于内核的文件系统,有sun公司开发,通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,它基于rpc实现(rpc是remote procedure call protocol 远程过程调用).RPC采用C/S模式,客户机请求程序调用进程发送一个有进程参数的调用信息到服务进程,然后等待应答信息.在服务器端,进程保存睡眠状态直到调用信息到达为止.当一个调用信息到达,服务器获得进程参数,计算结果,发

Linux系统部署YUM远程仓库及NFS共享服务

YUM概述 YUM 基于RPM包构建的软件更新机制 可以自动解决依赖关系 所有软件包由集中的YUM软件仓库提供 软件仓库的提供方式 FTP服务:ftp://... HTTP服务:http://... 本地目录:file://... RPM软件包的来源 CentOS发布的RPM包集合 第三方组织发布的RPM包集合 用户自定义的RPM包集合 构建CentOS 7软件仓库 RPM包来自CentOS 7光盘 通过FTP.HTTP或本地目录提供给客户机 FTP服务名称:vsftpd FTP站点:/var/

Linux的nfs文件服务

一.NFS概念 二.安装nfs启动服务 yum install nfs-utils systemctl enbale nfs-serversystemctl start nfs-server 三.建立共享目录 1.建立文件 exportfs -rv                    使更改生效 2.配置nfs主配置文件vim /etc/exports /westosshare            *(sync)             westosshare 共享给所有人并且数据同步 3.

linux下nsf服务搭建

实验环境 RHEL5.9两台 实验一: 将/root 共享给192.168.10.20,可写.同步,允许客户机以root权限访问 服务端配置: [[email protected] ~]# rpm -qa |grep nfs  //检查软件包是否安装 nfs-utils-lib-1.0.8-7.9.el5 nfs-utils-1.0.9-66.el5 [[email protected] ~]# rpm -qa |grep portmap portmap-4.0-65.2.2.1 [[email

《NFS文件共享服务的搭建》RHEL

首先要清楚一点:NFS服务的共享是建立在linux和linux之间的. 配置任何服务之前我们要做的2件事: iptables  -F setenforce 0    NFS服务内核防火墙影响不大,主要还是iptables 服务端: 安装nfs服务软件包: 启动nfs服务 下面说一个NFS服务起不来的解决方法,这个错误还是比较常见的. 报错:RPC.....问题,这个是因为我把rpc给关了: 把rpc打开重启下服务: 服务端共享出去/mnt对所有的主机(以只读的方式) 客户端 终端为白色 首先要识

linux网络文件共享服务的实现

LINUX网络文件共享服务 linux网络文件共享服务的实现: 应用层:ftp 内核:nfs (Sun) 跨平台:samba 一.vsftp实现文件共享 1,  概念: vsftpd :very secure FTP daemon,高安全性的 FTP 服务器. ftp: File Transfer Protocol文件传输协议:属于应用层协议,使用TCP端口: 21/tcp. FTP会话时包含了两个通道,一个叫控制通道,一个叫数据通道. 控制通道:控制通道是和FTP服务器进行沟通的通道,连接FT

2015-05-20 NFS/FTP服务配置

一. NFS1. NFS简介NFS全称是network file systemNFS允许一个系统在网络上与他人共享目录和文件.通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件. 假如有三台机器A, B, C,它们需要访问同一个目录,目录中都是图片,传统的做法是把这些图片分别放到A, B, C. 但是使用NFS只需要放到A上,然后A共享给B和C即可.访问的时候,B和C是通过网络的方式去访问A上的那个目录的. 2. 安装.配置NFS服务 服务端配置NFS [[email prot