Autofs NFS server set up and automatically mount the NFS server set up and automatically mount autofs

NFS server set up and automatically mount autofs

 

NFS server set up and automatically mount autofs

First, what is the NFS:

NFS (Network File System) that is a network file system, FreeBSD is a supported file system, which allows sharing of resources between computers on the network. In the application of the NFS, the NFS client's local application can transparently read and write files located on a remote NFS server, just like access local files.

What Autofs is:

mount is used to mount the file system can be mounted can be mounted after the system starts at system startup. For local fixation device, such as a hard disk may be used to mount mount; while discs, floppy disks, NFS, SMB file systems such as dynamic, i.e. the time required is only necessary to mount. CD-ROM and floppy disk we generally know when you want to mount, NFS and SMB sharing, but not necessarily know that we generally can not know in time when SMB and NFS shares can be mounted. The autofs service to provide this functionality, like windows automatically open the CD-ROM feature, the ability to mount the file system dynamically loaded. Eliminating the need to manually mount our troubles. To achieve CD-ROM, floppy disk and other dynamic automatically mount, the need for relevant configuration.

two. Detailed NFS file

1. / data / shared directory indicates the need

2. IP indicates which allows access to the client.

3. IP parentheses after setting represents the rights to the shared files.

4. ro read-only access

5. rw read and write access

6. sync data is written to all sharing request

UID 7. all_squash share files and GID mapping anonymous user anonymous, for the public directory.

8. no_all_squash reserved share files UID and GID (default)

9. root_squash root user requests all mapped to the same rights as anonymous user (default)

Full administrative access 10. no_root_squash root user with root directory

Three. NFS server set up and automatically mount autofs

(1). Installation NFS server

1 yum install nfs-utils -y # mounting nfs

2 systemctl start nfs # service nfs open

3 systemctl enable nfs # boot from the start

(2) configure NFS server

1 mkdir /westos

2 echo 'hello, world'> / westos / hello # create the directory / westos, in which to create a test file hello

(3) By modifying the NFS configuration, shared / data / share / directory

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

[root@nfsserver ~]# 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)

(4) The client install NFS client and autofs start and related services

[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

(5) The server test

1 showmount -e 192.168.1.152

2 Export list for 192.168.1.152:

3 / westos *

(6). Configure the client to automatically mount (autofs) NFS server shared directory

[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 mount point for the operation to mount the /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 -EN soft, in 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

(7) Restart the autofs service, and check if the file take effect automatically mount

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

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

[root@nfsclient nfsdata]# ls - 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

Filesystem   /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 34G 6% 1.9g / mnt / nfsdata

So we basically completed the NFS server set up and automatically mount the autofs.

NFS server set up and automatically mount autofs

First, what is the NFS:

NFS (Network File System) that is a network file system, FreeBSD is a supported file system, which allows sharing of resources between computers on the network. In the application of the NFS, the NFS client's local application can transparently read and write files located on a remote NFS server, just like access local files.

What Autofs is:

mount is used to mount the file system can be mounted can be mounted after the system starts at system startup. For local fixation device, such as a hard disk may be used to mount mount; while discs, floppy disks, NFS, SMB file systems such as dynamic, i.e. the time required is only necessary to mount. CD-ROM and floppy disk we generally know when you want to mount, NFS and SMB sharing, but not necessarily know that we generally can not know in time when SMB and NFS shares can be mounted. The autofs service to provide this functionality, like windows automatically open the CD-ROM feature, the ability to mount the file system dynamically loaded. Eliminating the need to manually mount our troubles. To achieve CD-ROM, floppy disk and other dynamic automatically mount, the need for relevant configuration.

two. Detailed NFS file

1. / data / shared directory indicates the need

2. IP indicates which allows access to the client.

3. IP parentheses after setting represents the rights to the shared files.

4. ro read-only access

5. rw read and write access

6. sync data is written to all sharing request

UID 7. all_squash share files and GID mapping anonymous user anonymous, for the public directory.

8. no_all_squash reserved share files UID and GID (default)

9. root_squash root user requests all mapped to the same rights as anonymous user (default)

Full administrative access 10. no_root_squash root user with root directory

Three. NFS server set up and automatically mount autofs

(1). Installation NFS server

1 yum install nfs-utils -y # mounting nfs

2 systemctl start nfs # service nfs open

3 systemctl enable nfs # boot from the start

(2) configure NFS server

1 mkdir /westos

2 echo 'hello, world'> / westos / hello # create the directory / westos, in which to create a test file hello

(3) By modifying the NFS configuration, shared / data / share / directory

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

[root@nfsserver ~]# 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)

(4) The client install NFS client and autofs start and related services

[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

(5) The server test

1 showmount -e 192.168.1.152

2 Export list for 192.168.1.152:

3 / westos *

(6). Configure the client to automatically mount (autofs) NFS server shared directory

[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 mount point for the operation to mount the /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 -EN soft, in 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

(7) Restart the autofs service, and check if the file take effect automatically mount

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

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

[root@nfsclient nfsdata]# ls - 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

Filesystem   /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 34G 6% 1.9g / mnt / nfsdata

So we basically completed the NFS server set up and automatically mount the autofs.

Guess you like

Origin www.cnblogs.com/wycom/p/11891988.html