linux服务器设置自动挂载目录
来源:互联网 发布:卡盟主站域名大全 编辑:程序博客网 时间:2024/06/06 15:47
1:配置/etc/exports文件
把需要共享的文件系统直接编辑到/etc/exports文件中,这样当NFS服务器重新启动时系统就会自动读取/etc/exports文件,从而告诉内核要输出的文件系统和相关的存取权限。如在server2的/etc/exports:
/var/spool/test1 server1(rw) server2(rw)
/var/spool/test2 server1(rw) server2(rw)
/var/spool/test3 server1(rw) server2(rw)
2:autofs的主要配置文件有两个,分别是/etc下的auto.master和auto.misc。其中,auto.master是起控制作用的,它定义了挂在点和automount动作的文件。其内容如下:
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $## 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 #/misc是定义的自动mount的挂载点,/etc/auto.misc里定义了mount的动作/home /etc/auto.home #/home是定义的自动mount的挂载点;/etc/auto.home定义了mount的动作, #此文件系统默认不存在,需要我们手工创建。/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
/etc/auto.misc的内容如下:
## $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $## This is an automounter map and it has the following format# key [ -mount-options-separated-by-comma ] location# Details may be found in the autofs(5) manpagecd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom #将/dev/cdrom自动挂载到/misc/cd/下# the following entries are samples to pique your imagination#linux -ro,soft,intr ftp.example.org:/pub/linux #将ftp.example.org的共享目录 #/pub/linux/自动挂载到/misc/linux/下#boot -fstype=ext2 :/dev/hda1 #将本地磁盘分区/dev/hda1自动挂载到/misc/boot下#floppy -fstype=auto :/dev/fd0 #将软盘设备/dev/fd0自动挂载到/misc/floppy下#floppy -fstype=ext2 :/dev/fd0#e2floppy -fstype=ext2 :/dev/fd0#jaz -fstype=ext2 :/dev/sdc1#removable -fstype=ext2 :/dev/hdd
在server1的/etc/auto.misc文件中添加如下设置:
test1 -fstype=nfs,rw,nolock server2:/var/spool/test1
test2 -fstype=nfs,rw,nolock server2:/var/spool/test2
test3 -fstype=nfs,rw,nolock server2:/var/spool/test3
保存后,cd /misc/test1
server1就可以访问server2的共享目录了。
- linux服务器设置自动挂载目录
- linux下设置开机自动挂载其他主机的samba共享目录
- linux自动挂载window共享目录
- linux下自动挂载samba目录
- Linux服务器 数据库自动备份 防火墙设置
- Linux服务器设置ssh超时自动注销
- Linux CentOS SVN 设置钩子hooks/post-commit来同步更新服务器web目录,实现代码自动部署
- linux下目录共享挂载设置
- linux (debian) 设置开机自动挂载
- 设置linux开机自动挂载硬盘
- 设置LINUX 服务器中FTP 用户登录的默认目录
- linux中自动挂载windows 共享目录
- Linux下自动挂载Windows Samba共享目录
- linux下mount和自动挂载windows共享目录
- Linux自动磁盘挂载工具home目录版
- linux 启动ftp 两台服务器挂载同一目录
- MacPorts—挂载远程Linux服务器目录到本地
- 云服务器Linux 磁盘分区、格式化、目录挂载
- ffmpeg的精简
- 第二堂课后作业
- java面试题及答案
- Spring的几种加载方式
- 第二次上机指导
- linux服务器设置自动挂载目录
- java基础之String类
- Java堆、栈和常量池详解
- Codeforces Beta Round #1--C题(多边形求最小面积)
- ZOJ 1110 Dick and Jane
- vos2009 安装后,打开了相应的端口,仍然单通,但关了防火墙可以双通
- hibernate三种状态
- 关于properties文件的读取
- Android颜色