One, based on the Linux NFS file system automatic mount mode,
Two Linux servers in the pre-preparation environment:
Prepare an NFS server side (System environment CENTOS6.5,IP address 192.168.100.100)
Preparing the NFS client to mount the NFS server (System Environment CENTOS6.5,IP address 192.168.100.101)
Implement:
Server-side installation NFS is now guaranteed to be properly accessed, and we can install it here with the Yum tool
[email protected] ~]# Yum install nfs-utils rpcbind-y
Share the/data/share/directory by modifying the NFS configuration
[Email protected] ~]# Mkdir/data/share
[Email protected] ~]# Vim/etc/exports
######### #shared data for BBS by Oldboy at 20160825
#/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)
Check if NFS is working
[Email protected] ~]# showmount-e 192.168.100.100
Export list for 192.168.100.100:
/data/share 192.168.100.0/24
Client installs NFS client and AutoFS and initiates related services
[email protected] ~]# Yum install rpcbind nfs-utils-y
[email protected] ~]# Yum install autofs-y
[[email protected] ~]#/etc/init.d/rpcbind start
[[email protected] ~]#/etc/init.d/autofs start
Configure Client Auto-mount (AUTOFS) NFS server-side shared directory
/mnt /etc/auto.misc timeout=60#/mnt for Mount point /etc/auto.misc for Mount action
[email protected] ~]# Vim/etc/auto.misc
# a Automounter map and it has the following format
# key [-mount-options-separated-by-comma] Location
# Details May is found in the AutoFS (5) manpage
Cd-fstype=iso9660,ro,nosuid,nodev:/dev/cdrom
# The following entries is samples to pique your imagination
#linux-ro,soft,intr Ftp.example.org:/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. Restart the AutoFS service and check that the auto mount file is active
[Email protected] ~]#/etc/init.d/autofs restart
[Email protected] ~]# Cd/mnt/nfsdata
[Email protected] nfsdata]# ls-l
Total 0
-rw-r--r--1 oldgirl oldgirl 0 00:14 Andy
-rw-r--r--1 oldgirl oldgirl 0 00:10 Oldboy
-rw-rw-r--1 oldgirl oldgirl 0 00:10 Oldgirl
[Email protected] 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
Linux NFS Auto Mount AutoFS configuration