nfs自动挂载
服务器端
/etc/exports
/mnt *(rw,sync,no_root_squash,anonuid=500,anongid=500)
systemctl restart nfs
客户端
挂载有两种
1.mount -t nfs 192.168.100.124:/mnt /test
vim /etc/fstab
nfs挂载:192.168.100.124:/mnt/ /test nfs defaults 0 0
window共享后的挂载方式:
192.168.100.X/mnt /test cifs defaults ,auto,uid=500,gid=500,domain=abc,username=abc.password=abc 0 0
2.使用autofs
vim /etc/auto.master
添加自动挂载的路径 和配置文件
例子:
在auto.master中添加/ceshi/guazai /etc/auto.mvp 这里/ceshi/guazai 是挂载路径,此时如果ceshi目录不存在,他会自动创建,如果guazai目录存在,他会将挂载目录的内容移到缓存中,并根据auto来挂载新的数据,此时guazai目录无法被写入。请确保改路径下没有数据。
vim /etc/auto.mvp
nfs -fstype=nfs 192.168.100.124:/mnt nfs表示挂载的路径文件名,会自动生成这个文件夹
systemctl start autofs
参考连接:https://blog.51cto.com/pascaljanus/495132
如果根据账号密码则如下设置:
- root@localhost:~# cat /etc/auto.misc
- backup -fstype=cifs,username=backup_user@domain,password=backup_password ://192.168.1.1/backup
以下是转载的参考链接:
链接地址:https://blog.51cto.com/pascaljanus/495132
1.检查和安装autofs
- dpkg -l | grep autofs
- sudo apt-get install autofs5
2.编辑/etc/auto.master文件,启用misc目录
- root@localhost:~# cat /etc/auto.master
- #
- # Sample auto.master file
- # This is an automounter map and it has the following format
- # key [ -mount-options-separated-by-comma ] location
- # For details of the format look at autofs(5).
- #
- /misc /etc/auto.misc
- #
- # NOTE: mounts done from a hosts map will be mounted with the
- # "nosuid" and "nodev" options unless the "suid" and "dev"
- # options are explicitly given.
- #
- #/net -hosts
- #
- # Include central master map if it can be found using
- # nsswitch sources.
- #
- # Note that if there are entries for /net or /misc (as
- # above) in the included master map any keys that are the
- # same will not be seen as the first read key seen takes
- # precedence.
- #
- +auto.master
3.修改/etc/auto.misc文件,添加cifs挂载项
- root@localhost:~# cat /etc/auto.misc
- backup -fstype=cifs,username=backup_user@domain,password=backup_password ://192.168.1.1/backup
4.重启autofs服务
- root@localhost:~# service autofs restart
5.检查是否成功挂载
- root@localhost:~# ls -l /misc/backup
- total 3
- drwxrwxrwx 1 root root 0 2011-02-16 10:25 dns_backup
- drwxrwxrwx 1 root root 0 2011-02-16 09:37 mail_backup
- drwxrwxrwx 1 root root 0 2011-02-16 09:30 system_backup
- root@localhost:~# mount
- ...
- //192.168.1.1/backup on /misc/backup type cifs (rw,mand)
值得注意的是如果通过AD域来认证,则要在用户名后加@domain(domain是AD域的域名,如company.com)才能成功挂载,尝试过用户名的另一种表示方法,domain\username,但不是每一次都能成功,所以选择前者。虽然挂载选项显示可读写,但要在远端服务器上设置相应的权限才能操作
nfs自动挂载的更多相关文章
- linux NFS 自动挂载
NFS 自动挂载的两种方法 第一种: 需要注意的事项 开机挂载的命令不能写入到/etc/fstab 中,由于 NFS 依赖于网络,而/etc/fstab 的引用是在计算机 网络尚未启动的时候就开始引导 ...
- autofs实现nfs自动挂载
apt-get install autofs 主配置文件/etc/auto.master 副配置文件可以在之配置文件中自定义 能生效的配置文件如下例: 将/usr/local/nginx/html挂载 ...
- NFS使用autofs自动挂载
NFS自动挂载设置在/etc/fstab和/etc/rc.local可能挂载不成功,假如是服务端NFS宕机还可能导致客户端无法启动,可以使用autofs实现自动挂载 安装autofs yum -y i ...
- NFS配置及开机自动挂载
环境:Red Hat 6.7 服务端:192.168.163.128 客户端:192.168.163.131 背景:解决多个服务器之间数据共享 环境检查: 1.检查服务器是否安装nfs服务 rpm ...
- ubuntu 开机自动挂载nfs服务器上的home分区
通过‘fstab’也可以配置 NFS 和 SMB 的共享目录.由于涉及到的可选项很重要,并且需要了解一些协议的工作情况,您得先阅读 Samba 和 NFS . 基本语法和本地介质相差不是很多.条目中的 ...
- Linux:SAMBA共享、NFS共享、Autofs自动挂载
SAMBA.NFS共享区别 NFS开源文件共享程序:NFS(NetworkFile System)是一个能够将多台Linux的远程主机数据挂载到本地目录的服务,属于轻量级的文件共享服务,不支持Linu ...
- NFS 开机自动挂载共享目录
开机自动挂载: 如果服务端或客户端的服务器重启之后需要手动挂载,我们可以加入到开机自动挂载 在服务端/客户端的/etc/fstab里添加 192.168.22.204:/opt/filestore ...
- Linux服务——二、配置NFS及autofs自动挂载服务
一.NFS服务配置步骤 NFS的作用:能够使两台虚拟机之间实现文件共享.数据同步 准备:主机名.网络.yum源 Server端: 1.安装nfs-util和rpcbind:(图形化自带) [root@ ...
- 实现nfs持久挂载+autofs自动挂载
实验环境: 两台主机 node4:192.168.37.44 NFS服务器 node2:192.168.37.22 客户端 在nfs服务器,先安装nfs和rpcbind [root@node4 fen ...
随机推荐
- 点亮一个LED之参数传递规则
1 说明 实验平台: JZ2440 CPU: S3C2440 2 ARM-THUMB Procedure Call Standard(ATPCS: ARM-Thumb过程调用标准) 图1 ...
- pacificrack 控制面板登录不上的问题
我今天又试了一下: https://master-stack01.pacificrack.com还是登不上(这个一键烦恼了我一个星期了,但是我今天百度出来了解决办法) 然后用这个就可以了 https ...
- POJ 1151:Atlantis 线段树+扫描线
Atlantis Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19374 Accepted: 7358 Descrip ...
- HihoCoder第七周:完全背包问题
1043 : 完全背包 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 且说之前的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励的时 ...
- Glusterfs volume 的三种挂载方式
在上一篇中我们介绍了Glusterfs在CentOS7上的安装,并且提到Glusterfs client端有三种:Native client,NFS,Samba, 今天我们就来一起学习下这三种方式. ...
- com.alibaba.druid.pool.DruidDataSource
https://www.cnblogs.com/wuyun-blog/p/5679073.html DRUID介绍 DRUID是阿里巴巴开源平台上一个数据库连接池实现,它结合了C3P0.DBCP.PR ...
- 超低功耗Sub-1GHz性价比首选方案:CMT2300
关于超低功耗Sub-1GHz射频收发器,目前性价比方面CMT2300是一款大多客户的首选方案,不管是成本方面还是性能方面,都能大大的满足客户的需求.下面为大家讲解下CMT2300 这款Sub-1GHz ...
- cf 766#
天呢,太垃圾了我.. AB懵逼了半天题意,C最后搞了个DP还不对...DP太垃圾了,, #include<bits/stdc++.h> #define INF 0x7fffffff #de ...
- cf 609E.Minimum spanning tree for each edge
最小生成树,lca(树链剖分(太难搞,不会写)) 问存在这条边的最小生成树,2种情况.1.这条边在原始最小生成树上.2.加上这条半形成一个环(加上),那么就找原来这条边2端点间的最大边就好(减去).( ...
- 集合框架的详解,List(ArrayList,LinkedList,Vector),Set(HashSet,TreeSet)-(14)
集合详解: /* Collection |--List:元素是有序的,元素可以重复.因为该集合体系有索引. |--ArrayList:底层的数据结构使用的是数组结构.特点:查询速度很快.但是增删稍慢. ...