惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
Y
Y Combinator Blog
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Check Point Blog
M
MIT News - Artificial intelligence
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
博客园 - 司徒正美
I
InfoQ
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
U
Unit 42

博客园 - Winner.Net(2007)

centos 端口开放及关闭 Can't connect to MySQL server on 'ip' (13) CentOS 6.0 系统 LAMP(Apache+MySQL+PHP)安装步骤 PHP与MYSQL事务处理 型B2C电子商务网站组织架构分析 转 PHP _construct _destory _call _get _set等 - Winner.Net(2007) eew CSS+js 实现mouse移动单元格上全部显示 web2.0网站的性能优化方法 (转) Web应用性能优化黄金法则——转 js编码处理(转) 服务器推技术 网页标签解析 转http状态码 登陆抓取数据 - Winner.Net(2007) - 博客园 观察者+js 模式 - Winner.Net(2007) - 博客园 JS倒计时 - Winner.Net(2007) - 博客园 sql得到时间 EXT 列头合并的例子 - Winner.Net(2007) - 博客园
linux 开启 mount
Winner.Net(2007) · 2011-11-17 · via 博客园 - Winner.Net(2007)

linux 开启 mount
 
 
 
出错: rpc mount export: RPC: Unable to receive; errno = No route to host

首先开启portmap 服务
service portmap start

iptables -A INPUT -p TCP --dport 111 -m state --state NEW -j ACCEPT
iptables -A INPUT -p UDP --dport 111 -m state --state NEW -j ACCEPT

编辑# vi /etc/sysconfig/nfs
MOUNTD_PORT="4002"
STATD_PORT="4003"
LOCKD_TCPPORT="4004"
LOCKD_UDPPORT="4004"

service nfs start

iptables -A INPUT -p TCP --dport 2049 -m state --state NEW -j ACCEPT
iptables -A INPUT -p UDP --dport 2049 -m state --state NEW -j ACCEPT
iptables -A INPUT -p TCP --dport 4002:4004 -m state --state NEW -j ACCEPT
iptables -A INPUT -p UDP --dport 4004 -m sate --state NEW -j ACCEPT

过程:

一:服务器端的设定

服务器端的设定都是在/etc/exports这个文件中进行设定的,设定格式如下:

欲分享出去的目录主机名称1或者IP1(参数1,参数2) 主机名称2或者IP2(参数3,参数4)

上面这个格式表示,同一个目录分享给两个不同的主机,但提供给这两台主机的权限和参数是不同的,所以分别设定两个主机得到的权限。

可以设定的参数主要有以下这些:

rw:可读写的权限;

ro:只读的权限;

no_root_squash:登入到NFS主机的用户如果是ROOT用户,他就拥有ROOT的权限,此参数很不安全,建议不要使用。

root_squash:在登入 NFS

nobody 身份;

all_squash:不管登陆NFS主机的用户是什么都会被重新设定为nobody。

anonuid:将登入NFS主机的用户都设定成指定的user id,此ID必须存在于/etc/passwd中。

anongid:同 anonuid,但是变成 group ID 就是了!

sync:资料同步写入存储器中。

async:资料会先暂时存放在内存中,不会直接写入硬盘。

insecure允许从这台机器过来的非授权访问。

例如可以编辑/etc/exports为:

/tmp     *(rw,no_root_squash)

/home/public 192.168.0.*(rw)  *(ro)

/home/test  192.168.0.100(rw)

/home/linux *.the9.com(rw,all_squash,anonuid=40,anongid=40)

设定好后可以使用以下命令启动NFS:

/etc/rc.d/init.d/portmap start (在REDHAT中PORTMAP是默认启动的)

/etc/rc.d/init.d/nfs start

exportfs命令:

如果我们在启动了NFS之后又修改了/etc/exports,是不是还要重新启动nfs呢?这个时候我们就可以用exportfs命令来使改动立刻生效,该命令格式如下:

exportfs [-aruv]

-a :全部mount或者unmount /etc/exports中的内容

-r :重新mount /etc/exports中分享出来的目录

-u :umount 目录

-v :在 export的時候,将详细的信息输出到屏幕上。

具体例子:

[root @test root]# exportfs -rv <==全部重新 export 一次!

exporting 192.168.0.100:/home/test

exporting 192.168.0.*:/home/public

exporting *.the9.com:/home/linux

exporting *:/home/public

exporting *:/tmp

reexporting 192.168.0.100:/home/test to kernel

exportfs -au< ==全部都卸载了。

客户段的操作:需要开启(portmap + nfslock )

1、showmout命令对于NFS的操作和查错有很大的帮助,所以我们先来看一下showmount的用法

showmout

-a :这个参数是一般在NFS SERVER上使用,是用来显示已经mount上本机nfs目录的cline机器。

-e :显示指定的NFS SERVER上export出来的目录。

例如:

showmount -e 192.168.0.30

Export list for localhost:

/tmp *

/home/linux *.linux.org

/home/public (everyone)

/home/test 192.168.0.100

2、mount nfs目录的方法:

mount -t nfs hostname(orIP):/directory /mount/point

具体例子:

Linux: mount -t nfs 192.168.0.1:/tmp /mnt/nfs

Solaris:mount -F nfs 192.168.0.1:/tmp /mnt/nfs

BSD: mount 192.168.0.1:/tmp /mnt/nfs

本文出自 “seven” 博客,请务必保留此出处http://liuyu.blog.51cto.com/183345/272466
 

linux 开启 mount