700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > linux autofs ftp Linux NFS自动挂载autofs配置

linux autofs ftp Linux NFS自动挂载autofs配置

时间:2020-09-13 11:26:46

相关推荐

linux autofs ftp Linux NFS自动挂载autofs配置

一、基于Linux下NFS文件系统的自动挂载方式,

前期准备环境两台Linux服务器:准备一台NFS服务器端(系统环境centos6.5,ip地址192.168.100.100)

准备需要挂载NFS服务端的NFS客户端(系统环境centos6.5,ip地址192.168.100.101)

实施:现在server端安装NFS保证能正常访问,我们这里通过yum工具安装即可

[root@nfsserver ~]# yum install nfs-utils rpcbind -y

通过修改NFS配置,共享/data/share/目录

[root@nfsserver ~]# mkdir /data/share

[root@nfsserver ~]# vim /etc/exports

##########shared data for bbs by oldboy at 0825

#/data/share 192.168.100.0/24(rw,sync,hide)

/data/share 192.168.100.0/24(rw,sync,anonuid=555,anongid=555,all_squash)

检查NFS是否正常

[root@nfsserver ~]# showmount -e 192.168.100.100

Export list for 192.168.100.100:

/data/share 192.168.100.0/24

客户端安装NFS客户端及autofs并启动相关服务

[root@nfsclient ~]# yum install rpcbind nfs-utils -y

[root@nfsclient ~]# yum install autofs -y

[root@nfsclient ~]# /etc/init.d/rpcbind start

[root@nfsclient ~]# /etc/init.d/autofs start

配置客户端自动挂载(autofs)NFS服务端共享目录

[root@nfsclient ~]# vim /etc/auto.master

#

# Sample auto.master file

# This is a 'master' automounter map and it has the following format:

# mount-point [map-type[,format]:]map [options]

# For details of the format look at auto.master(5).

#

/misc /etc/auto.misc

/mnt /etc/auto.misc timeout=60#/mnt为挂载点 /etc/auto.misc为挂载动作

[root@nfsclient ~]# vim /etc/auto.misc

# 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) manpage

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

# the following entries are samples to pique your imagination

#linux -ro,soft,intr :/pub/linux

#boot -fstype=ext2 :/dev/hda1

#floppy -fstype=auto :/dev/fd0

#floppy -fstype=ext2 :/dev/fd0

#e2floppy -fstype=ext2 :/dev/fd0

#jaz -fstype=ext2 :/dev/sdc1

#removable -fstype=ext2 :/dev/hdd

nfsdata -fstype=nfs 192.168.100.100:/data/share

6.重新启动autofs服务,并检查自动挂载文件是否生效

[root@nfsclient ~]# /etc/init.d/autofs restart

[root@nfsclient ~]# cd /mnt/nfsdata

[root@nfsclient nfsdata]# ls -l

total 0

-rw-r--r-- 1 oldgirl oldgirl 0 Aug 27 00:14 andy

-rw-r--r-- 1 oldgirl oldgirl 0 Aug 27 00:10 oldboy

-rw-rw-r-- 1 oldgirl oldgirl 0 Aug 27 00:10 oldgirl

[root@nfsclient nfsdata]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_muban-moban_root 38G 1.9G 34G 6% /

tmpfs 491M 0 491M 0% /dev/shm

/dev/sda1 194M 29M 155M 16% /boot

192.168.100.100:/data/share 38G 1.9G 34G 6% /mnt/nfsdata

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。