ubuntu 使用NFS共享
2014-08-15 16:16
190 查看
系统介绍:
root@master:~# cat /etc/issue
Ubuntu 12.04.1 LTS \n \l
root@master:~# uname -a
Linux master 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
root@master:~#
安装步骤:
PS:一下操作只针对上述操作系统有效,且真实测试有效
步骤一:
安装NFS服务端
apt-get install nfs-kernel-server
配置共享目录(关于参数后续介绍)
vim /etc/exports
/opt/html *(rw,sync,no_root_squash)
启动NFS Server
/etc/init.d/portmap restart
/etc/init.d/nfs-kernel-server restart
步骤二、
客户端挂载NFS
mount -t nfs 192.168.1.185:/opt/html /var/www/html
查看是否挂载成功
root@ubuntu-1:~# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/ubuntu-root 464G 8.2G 432G 2% /
udev 869M 4.0K 869M 1% /dev
tmpfs 351M 320K 351M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 878M 0 878M 0% /run/shm
/dev/sda1 228M 25M 192M 12% /boot
192.168.1.185:/opt/html 48G 3.2G 43G 7% /var/www/html
Ubuntu nfs 常用的参数有:
ro 只读访问
rw 读写访问
sync 所有数据在请求时写入共享
async nfs 在写入数据前可以响应请求
secure nfs 通过 1024 以下的安全 TCP/IP 端口发送
insecure nfs 通过 1024 以上的端口发送
wdelay 如果多个用户要写入 nfs 目录,则归组写入(默认)
no_wdelay 如果多个用户要写入 nfs 目录,则立即写入,当使用 async 时,
无需此设置。
hide 在 nfs 共享目录中不共享其子目录
no_hide 共享 nfs 目录的子目录
subtree_check 如果共享/usr/bin 之类的子目录时,强制 nfs 检查父目录
的权限(默认)
no_subtree_check 和上面相对,不检查父目录权限
all_squash 共享文件的 UID 和 GID 映射匿名用户 anonymous,适合公用目
录。
no_all_squash 保留共享文件的 UID 和 GID(默认)
root_squash root 用户的所有请求映射成如 anonymous 用户一样的权限(默
认)
no_root_squas root 用户具有根目录的完全管理访问权限
anonuid=xxx 指定 nfs 服务器/etc/passwd 文件中匿名用户的 UID
anongid=xxx 指定 nfs 服务器/etc/passwd 文件中匿名用户的 GID
报错:
mount: wrong fs type, bad option, bad superblock on 192.168.1.195:/opt/html,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
解决办法:
apt-get install nfs-common
本文出自 “精忠报国” 博客,请务必保留此出处http://xinsir.blog.51cto.com/5038915/1540692
root@master:~# cat /etc/issue
Ubuntu 12.04.1 LTS \n \l
root@master:~# uname -a
Linux master 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
root@master:~#
安装步骤:
PS:一下操作只针对上述操作系统有效,且真实测试有效
步骤一:
安装NFS服务端
apt-get install nfs-kernel-server
配置共享目录(关于参数后续介绍)
vim /etc/exports
/opt/html *(rw,sync,no_root_squash)
启动NFS Server
/etc/init.d/portmap restart
/etc/init.d/nfs-kernel-server restart
步骤二、
客户端挂载NFS
mount -t nfs 192.168.1.185:/opt/html /var/www/html
查看是否挂载成功
root@ubuntu-1:~# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/ubuntu-root 464G 8.2G 432G 2% /
udev 869M 4.0K 869M 1% /dev
tmpfs 351M 320K 351M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 878M 0 878M 0% /run/shm
/dev/sda1 228M 25M 192M 12% /boot
192.168.1.185:/opt/html 48G 3.2G 43G 7% /var/www/html
Ubuntu nfs 常用的参数有:
ro 只读访问
rw 读写访问
sync 所有数据在请求时写入共享
async nfs 在写入数据前可以响应请求
secure nfs 通过 1024 以下的安全 TCP/IP 端口发送
insecure nfs 通过 1024 以上的端口发送
wdelay 如果多个用户要写入 nfs 目录,则归组写入(默认)
no_wdelay 如果多个用户要写入 nfs 目录,则立即写入,当使用 async 时,
无需此设置。
hide 在 nfs 共享目录中不共享其子目录
no_hide 共享 nfs 目录的子目录
subtree_check 如果共享/usr/bin 之类的子目录时,强制 nfs 检查父目录
的权限(默认)
no_subtree_check 和上面相对,不检查父目录权限
all_squash 共享文件的 UID 和 GID 映射匿名用户 anonymous,适合公用目
录。
no_all_squash 保留共享文件的 UID 和 GID(默认)
root_squash root 用户的所有请求映射成如 anonymous 用户一样的权限(默
认)
no_root_squas root 用户具有根目录的完全管理访问权限
anonuid=xxx 指定 nfs 服务器/etc/passwd 文件中匿名用户的 UID
anongid=xxx 指定 nfs 服务器/etc/passwd 文件中匿名用户的 GID
报错:
mount: wrong fs type, bad option, bad superblock on 192.168.1.195:/opt/html,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
解决办法:
apt-get install nfs-common
本文出自 “精忠报国” 博客,请务必保留此出处http://xinsir.blog.51cto.com/5038915/1540692
相关文章推荐
- 使用nfs在mac os x与ubuntu之间共享文件
- Ubuntu NFS服务配置和win7使用nfs共享方法
- Ubuntu 12.04.3 X64 使用 NFS 作为文件共享存储方式 安装 Oracle11g RAC
- [镜像制作]使用NFS实现Ubuntu的文件共享
- UBUNTU下如何使用NFS实现文件夹共享
- 使用nfs服务器将Windows和ubuntu进行文件共享
- 最近学习NFS文件系统的使用,Ubuntu上配置好了,想和Win7共享数据,所以网上搜到了这篇文章。借花献佛,跟大家共享一下:
- Ubuntu 10.10下配置NFS并挂载共享目录到目标板
- 虚拟机ubuntu下nfs配置,使用uboot nfs命令下载内核至mini2440
- Ubuntu下使用Simba服务实现局域网内文件共享
- Ubuntu 搭建 NFS服务提供给 SC2440或SC6410开发板使用【要点整理】
- tiny6410开发板使用NFS访问Ubuntu主机
- VirtualBox虚拟 Ubuntu时如何使用共享数据空间
- ubuntu下NFS安装与配置(实现两台linux之间的文件夹挂载与共享访问)
- VMware下Ubuntu使用hgfs共享主机文件(我是因为ubuntu升级后hgfs文件夹为空)
- 目标板使用nfs来共享文件
- Ubuntu下使用Simba服务实现局域网内文件共享
- ubuntu server 10.04 NFS 添加共享目录
- VMware下linux Ubuntu10.04使用NAT共享主机IP上网方式的设置参考
- ubuntu 10.10配置NFS网络共享步骤