AutoFs
Introduction
Note :- This tutorial explains the theoretical concepts of some AutoFS features, if you want to skip it and go to practical tutorial go to AutoFS Practical.
---------------------------------------------------------------------------------------------------------------
Lab Preparation
----------------------------------------------------------------------------------------------------------------
AutoFS Practical
---------------------------------------------------------------------------------------------------------------
Advantages of AutoFS :
AutoFs features :
➊ AutoFs is client side service, when we want to use AtuoFs we configure some files on client side.
➋ AutoFs Mount and unmount file systems on demand and automatically.
AutoFs Configuration :
➋ Direct Map
➌ Indirect Map
AutoFS Maps
Master Maps
ِِِAt the command prompt type :-
The /etc/master_map has the following syntax :
<mount-point> <map-name> <mount-options>
<mount-point> The full pathname of a directory that is used as the mount point.
<map-name> The map that used to find directions to locations or mount information.
The first line in /etc/master_map :
The second line in /etc/master_map :
then type :
4th line in /etc/auto_master
Direct Map
at client1 command prompt type :-
add the following line to the file :-
where :
to access server1:/directory1 type cd /home/directory1
to access server2:/directory2 type cd /home/directory2
to access server3:/directory3 type cd /home/directory3
Indirect Maps
Lists the mount points as relative path names. This map uses a relative path to establish the mount point on the client, Indirect map specifies the main mount point and the name of the map in /etc/auto_master,
where :-
➟ /share is the name of the local mount point.
➟ /etc/auto_share is the name of the indirect map.
Resources :-
➊ ExamPrep Solaris 10 by Bill Calkins
➋ Advanced System Administration for the Solaris™ 10 by SUN Microsystems
➌ Oracle Documentation
Introduction
The AutoFS facility provide a method to mount remote directory automatically whithout needing to use mount or umount command, when a user or application access an NFS (shared) file system, the mount is established, when the file system is no longer needed or has not been accessed for certain time period, the file system is automatically unmounted.
Note :- This tutorial explains the theoretical concepts of some AutoFS features, if you want to skip it and go to practical tutorial go to AutoFS Practical.
---------------------------------------------------------------------------------------------------------------
Tutorial Prerequisites
NFS file systemLab Preparation
----------------------------------------------------------------------------------------------------------------
Tutorial contents
AutoFS theoretical conceptsAutoFS Practical
---------------------------------------------------------------------------------------------------------------
Let's assume that we have two nodes (Server1 and client1), on server1 there is a directory we want to share it (/tmp_share), and we want to access the directory from client1, in this case we have two option :-
Option 1 : use traditional NFS by sharing the directory (/tmp_share) on server1 then create mount point on client1 and use mount command.
Option 2 : use AutoFS by sharing the directory (/tmp_share) on server1 then configure AutoFs on client 1 to access the (/tmp_share) without using mount command.
➊ Because shares are only mounted when they are accessed, system boot time is faster.
➋ The system doesn't have to wait for each NFS server to respond and the mount to succeed.
➋ The system doesn't have to wait for each NFS server to respond and the mount to succeed.
➌ it is more secure. Users on the client systems must know what directory is configured to mount the share before changing into that directory to force the mount.
➍ users can browse the contents of the shared directory if they have permission.AutoFs features :
➊ AutoFs is client side service, when we want to use AtuoFs we configure some files on client side.
➋ AutoFs Mount and unmount file systems on demand and automatically.
AutoFs Configuration :
AutoFs is initialized by automount (automountd daemon) which is run at boot time. there are three configuration files for AutoFs called AutoFS maps
➊ Master map ➋ Direct Map
➌ Indirect Map
these files contain information about the local mount point and remote shared directory, Now if a request is made to access remote shared directory the system goes through the following steps :
➊ AutoFS intercepts the request.
➋ AutoFS sends a message to the automountd daemon for the requested file system to be mounted.
➌ automountd locates the file system information in a map and performs the mount.
➍ AutoFS allows the intercepted request to proceed.
➎ AutoFS unmounts the file system after a period of inactivity.
➋ AutoFS sends a message to the automountd daemon for the requested file system to be mounted.
➌ automountd locates the file system information in a map and performs the mount.
➍ AutoFS allows the intercepted request to proceed.
➎ AutoFS unmounts the file system after a period of inactivity.
Master Maps
at start up the automount command reads the master map (/etc/auto_master), this map tells about other maps and mount points.
bash-3.00# more /etc/auto_master
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)auto_master 1.8 03/04/28 SMI"
#
# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
/home auto_home -nobrowse
/- auto_direct -ro
The /etc/master_map has the following syntax :
<mount-point> <map-name> <mount-options>
<mount-point> The full pathname of a directory that is used as the mount point.
<map-name> The map that used to find directions to locations or mount information.
The first line in /etc/master_map :
+auto_master
this file directs the automountd daemon to look at the NIS, NIS+, or LDAP databases before it reads the rest of the map. If this line is commented out, only the local files are searched unless the /etc/nsswitch.conf file specifies that NIS, NIS+, or LDAP should be searched. /net -hosts -nosuid,nobrowse
let us explain this line by example, assume you have an NFS server called server1 that has /share_directory directory shared, from you machine if you type bash-3.00# cd /net/server1 or bash-3.00# cd /net/10.109.9.15
where 10.109.9.15 is the ip address of server1.then type :
bash-3.00# ls
the output will be :- share_directory
that means you can access any shared directory in remote machine through the following command :- bash-3.00# cd /net/remote_machine_(name or IP)
Note :- if you want to use the remote machine name instead of IP address add the remote host name and its IP address in the /etc/hosts file.
When you specified /net with a hostname (server1), automountd looked at the map file—in this case, /etc/hosts—and found server1 and its IP address. It then went to server1, found the /share_directory file system, and created a local mount point for /net/server1/share_directory .
the third line in /etc/auto_master
/home auto_home -nobrowse
This map provides the mechanism to allow users to access their centrally located $HOME directories, i will explain it later in Lab Preparation .4th line in /etc/auto_master
/- auto_direct -ro
represent direct map.Direct Map
Lists the mount points as absolute (Full) path names. This map explicitly indicates the mount point on the client, let us say that you have an NFS servers server1,server2,server3 and in each server there is a shared directory directory1, directory2,directory3 and we want to make these shared directories available from client1.
bash-3.00# vi /etc/auto_direct
add the following line to the file :-
/home/directory1 -ro,soft server1:/directory1
/home/directory2 -ro,soft server2:/directory2
/home/directory3 -ro,soft server3:/directory3
where :
➟ /home/dierctory1,/home/directory2,/home/directory3 are directories created on client1 to act as mount points.
➟ -ro,soft :- ro refers to read only, soft This option returns an error if the server does not respond
➟ server1:/directory1,server2:/directory2,server3:/directory3 are remote hosts and remote shared directories
to access server2:/directory2 type cd /home/directory2
to access server3:/directory3 type cd /home/directory3
Indirect Maps
Lists the mount points as relative path names. This map uses a relative path to establish the mount point on the client, Indirect map specifies the main mount point and the name of the map in /etc/auto_master,
Example:- create an entry in the /etc/auto_master file by adding the following line (/share /etc/auto_share).
bash-3.00# vi /etc/auto_master
"/etc/auto_master" 12 lines, 268 characters
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)auto_master 1.8 03/04/28 SMI"
#
# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
/home auto_home -nobrowse
/- auto_direct -ro
/share /etc/auto_share
where :-
➟ /share is the name of the local mount point.
➟ /etc/auto_share is the name of the indirect map.
create the in direct map ( /etc/auto_share ) and add the following line
"directory server1:/share/directory"
vi /etc/auto_share
directory server1:/share/directory
create the directory called "directory" in /share.
to access the remote directory
bash-3.00# cd /share/directory
Note :- When making changes to the master map or creating a direct map, run the automount command to make the changes effective.
➊ ExamPrep Solaris 10 by Bill Calkins
➋ Advanced System Administration for the Solaris™ 10 by SUN Microsystems
➌ Oracle Documentation
0 comments:
Post a Comment