教程之家 > 操作系统 > Linux > 正文

Linux文件服务器NFS详解【2】

2014-02-27 14:12  教程之家  媛媛  
字号:T|T

三 NFS简单应用

[sql]

--第一步,安装软件

[root@serv01 ~]# yum install nfs* -y

--第二步,修改配置文件

[root@serv01 ~]# vim /etc/exports

[root@serv01 ~]# cat /etc/exports

/share *(ro)

#共享目录 共享IP地址或者网段 共享参数

[root@serv01 ~]# mkdir /share

--第三步,重启服务

[root@serv01 ~]# /etc/init.d/rpcbind restart

Stopping rpcbind: [ OK ]

Starting rpcbind: [ OK ]

[root@serv01 ~]# /etc/init.d/nfs restart

Shutting down NFS mountd: [ OK ]

Shutting down NFS daemon: [ OK ]

Shutting down NFS services: [ OK ]

Starting NFS services: [ OK ]

Starting NFS daemon: [ OK ]

Starting NFS mountd: [ OK ]

[root@serv01 ~]# exportfs -v

/share (ro,wdelay,root_squash,no_subtree_check)

--第四步,serv02挂载

#serv02

[root@serv02 ~]# mount192.168.1.11:/share /mnt

mount: wrong fs type, bad option, badsuperblock on 192.168.1.11:/share,

missing codepage or helper program, or other error

(for several filesystems (e.g. nfs, cifs) you might

need a /sbin/mount. helper program)

In some cases useful info is found in syslog - try

dmesg | tail or so

#出现这个错误,安装nfs相关的包

[root@serv02 ~]# yum install nfs* -y

[root@serv02 ~]# mount 192.168.1.11:/share/mnt

[root@serv02 ~]# cd /mnt

[root@serv02 /]# umount /mnt

[root@serv02 /]# mkdir /data

[root@serv02 /]# mount 192.168.1.11:/share/data

[root@serv02 /]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda2 9.7G 1.1G 8.1G 12% /

tmpfs 188M 0 188M 0% /dev/shm

/dev/sda1 194M 25M 160M 14% /boot

/dev/sda5 4.0G 137M 3.7G 4% /opt

/dev/sr0 3.4G 3.4G 0 100% /iso

192.168.1.11:/share 9.7G 1.1G 8.1G 12% /data

点击加载更多