sean@ubuntu:~$ df Filesystem 1K-blocks Used Available Use% Mounted on udev 488800 4 488796 1% /dev tmpfs 99904 1456 98448 2% /run /dev/sda1 19478204 3745568 14720156 21% / none 4 0 4 0% /sys/fs/cgroup none 5120 0 5120 0% /run/lock none 499512 152 499360 1% /run/shm none 102400 40 102360 1% /run/user /dev/sr0 1044480 1044480 0 100% /media/sean/Ubuntu 14.04.4 LTS amd64 192.168.137.128:/home/sean/shareDir 19478272 4288896 14176896 24% /home/sean/shared
此时如果我们在128的/home/sean/shareDir目录下创建一个文件,在129的/home/sean/shared目录下可以看到一个名称相同的文件,并且文件的内容也相同
六,开机启动NFS服务
安装完成之后查看系统服务
sean@sean:~$ runlevel
N 2
sean@sean:~$ ll /etc/rc2.d
total 20
drwxr-xr-x 2 root root 4096 6月 20 23:25 ./
drwxr-xr-x 132 root root 12288 6月 26 20:16 ../
-rw-r--r-- 1 root root 677 2月 17 12:59 README
lrwxrwxrwx 1 root root 20 2月 22 06:33 S20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 27 6月 20 23:25 S20nfs-kernel-server -> ../init.d/nfs-kernel-server*
lrwxrwxrwx 1 root root 15 2月 22 06:33 S20rsync -> ../init.d/rsync*
lrwxrwxrwx 1 root root 27 2月 22 06:33 S20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 15 2月 22 06:33 S50saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 19 2月 22 06:33 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 2月 22 06:33 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 21 2月 22 06:33 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx 1 root root 18 2月 22 06:33 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx 1 root root 18 2月 22 06:33 S99rc.local -> ../init.d/rc.local*
nfs-kernel-server是自动启动,就不需要再进行修改了,而rpcbind就比较麻烦了,找了半天才找到vi /etc/init/rpcbind-boot.conf
# portmap-boot
description "Upstart job to start rpcbind on boot only"
author "Clint Byrum"
emits start-rpcbind
start on virtual-filesystems and net-device-up IFACE=lo
task
exec initctl emit --no-wait start-rpcbind ON_BOOT=y
可以见到这个服务设为开机启动了
七,开机自动挂载共享盘
这时候我们需要修改的文件是/etc/fstab,命令格式如下:
<NFS服务端>:<共享目录> <本地目录> <文件系统类型> <选项> <dump> <pass>每个字段的具体含义这里就不详细解释了,vi /etc/fstab,在文件中添加下面这行配置
192.168.137.128:/home/sean/shareDir /home/sean/shared nfs defaults 0 0系统每次启动时即会自动挂载共享盘
以上这篇Ubuntu配置NFS的具体流程(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易采站长站。










