290 likes | 548 Views
Automating File Sharing. Chapter 19. Understand how to automount file systems under Windows. Understand how to create a consistent name space. Understand NFS automounter setup. Understand automounter map files. Chapter Goals.
E N D
Automating File Sharing Chapter 19
Understand how to automount file systems under Windows. • Understand how to create a consistent name space. • Understand NFS automounter setup. • Understand automounter map files. Chapter Goals
Windows has nothing really comparable to automount that will automatically mount remote disks on demand. • However, Windows shares can be configured to automatically mount when a user logs in. • The configuration begins by right clicking on the “Network Neighborhood” or “Network Places” icon and selecting “Map Network Drive” from the pop-up menu. • Selecting “Map Network Drive” will bring up a dialog box, where a drive letter is selected and assigned to a share. Automating File Sharing
This dialog includes three items to pay careful attention to. • The “Browse…” button. This allows a user to browse using an interface similar to the “Network Neighborhood” to locate the server and share. This is often easier than entering the share name directly into the “Folder” field. • The “Reconnect” checkbox. This is how the automatic mount of the sharing is set. Checking this box results in the drive mapping being saved and automatically performed next time the user logs in. • The “different user name” link. This link allows the user to enter an username and password different from the username and password used when they logged into the Windows system as shown in Figure 19-?. This is important for sites that use different authentication methods for Windows and UNIX and still wish to offer Samba shares to Windows users. Note that on login, a share that has a different user name and password will cause the automatic remounting process to prompt the user for the differing password at the point the mount is reconnected. Automating File Sharing
While this automatic mounting of shares is handy it does not address the basic problem of file sharing, server unavailability. • If the server the share is being mounted from fails, the network drive connection will be lost and must be manually remounted. • If the server is unavailable when the user logs in, the network drive will not be mounted even if the server later becomes available. • If a server fails, but another server offers the same services, manual intervention will be required to mount the backup server. • The UNIX automount service offers ways around these problems. Automating File Sharing
As mentioned in Chapter 18, “Network File Sharing,” growing networks present the system manager with many challenges. • As new machines are added, correctly maintaining the configuration files to export and mount the newly added file systems becomes an increasingly daunting chore. • In addition, when a file server becomes unavailable, processes on client workstations may stop even if they do not depend on that file server. • The automount service was developed to minimize these problems on UNIX systems. Automating File Sharing
The default mappings used by the automounter are often difficult for users to handle: • /tmp_mnt/servername/filesystem_name/user_dir • /net/servername/filesystem_name/user_dir • /home/servername/filesystem_name/user_dir • The system administrator needs to force the automounter to provide a consistent name space for the user’s directories. Automating File Sharing
What you want the system to do is map a file system from the server to an alternate mount point on the client Automating File Sharing
The automounter allows filesystems to be mounted on demand. • The administrator sets up some control files, and makes some mount point directories. • If/when a user references an a filesystem that is set up for the automounter, the NFS software looks it up in the files, and mounts the filesystem. • The control files are called “map files”. • There are several types of map files. • The most common map files are: Automating File Sharing
Master Maps - list all direct and indirect map files to be processed. # Master map for automount daemon /- auto_direct -ro /remote auto_indirect /home auto_home Automating File Sharing
direct maps – • lists of filesystems that do not share a common mount point. • /usr/man • /opt • /cs/tools # mount /usr/man from grissom /usr/man -ro grissom:/usr/man # mount framemaker binaries from grissom or chaffee /usr/frame -ro grissom:/usr/frame \ chaffee:/usr/frame2.0 Automating File Sharing
indirect maps • In an indirect map, the NFS file systems referred to by the map are mounted at a different mount point than the one listed in the table and a symbolic link is made from that location to the directory listed in the master map. • This allows for some more exotic automount tricks. # Item in RHS is mounted in location of LHS # mount /src from snow /usr/local/src src snowwhite:/usr/local/src bin snowwhite:/usr/local/bin gnu snowwhite:/usr/local/gnu Automating File Sharing
auto_home • One of the most common indirect maps is auto_home. • The auto_home map has keys in the /home directory. • It is used to collect users’ home directories into a single location, and greatly eases the task of maintaining home directory location information. dwight glenn:/export/home/& frank chaffee:/user2/& tom grissom:/export/users/& steve glenn:/export/home/& Note how the line starting with the key frank does not contain a full path. The key in an indirect map specifies the name of the symbolic link to be made in the directory specified in the entry for the map in the auto_master file. In this case, all the keys in the auto_home map will create symbolic links in the /home directory. Automating File Sharing
Automounter Variables • Variable - Meaning - Example • ARCH - CPU architecture type - sun4 • CPU - CPU type - SPARC • HOST - Host name - glenn • OSNAME - Operating system name - SunOS • OSREL - Operating system release number - 5.6 • OSVERS - Operating system version - FCS1.0 Automating File Sharing
Once all of the maps are set up, and the mount points have been created, you start the Solaris automount daemon with: • /etc/init.d/nfs.client start • /etc/init.d/autofs start • Automount can also be configured to mount the filesystem from the server that responds first! (Fault Tolerance) Automating File Sharing
AMD automounter is a more robust system, but takes more work to set up initially (because it is an add-in product). • The amd automounter, found on Linux and many BSD style UNIX variants uses a different and incompatible format for its map files. • The general concepts are the same, keyed entries that specify remote filesystems to be mounted, however the syntax is richer and offers greater control over how the map behaves in differing circumstances. • The analog to the auto_master file for the amd automounter is the amd.conf file found in /etc. • Beyond specifying the other maps to be consulted, amd.conf also includes a general stanza that allows the many option settings of amd to be configured. Automating File Sharing
# # amd default config file # # GLOBAL OPTIONS SECTION [ global ] normalize_hostnames = no print_pid = yes pid_file = /var/run/amd.pid restart_mounts = yes auto_dir = /.automount #log_file = /var/log/amd log_file = syslog log_options = all #debug_options = all plock = no selectors_on_default = yes print_version = no
# set map_type to "nis" for NIS maps, or comment it out to search for all # types map_type = file search_path = /etc browsable_dirs = yes show_statfs_entries = no fully_qualified_hosts = no cache_duration = 3600 local_domain = bio.purdue.edu # Bio map [ /bio ] map_name = /etc/bio.amd # PUCC map [ /pucc ] map_name = /etc/pucc.amd # CS map [ /cs ] map_name = /etc/cs.amd
As stated in the comment at the top of the amd.conf file, the many options listed are described in the manual page. • Note that the option keys and their assocated values are case sensitive. • Here are a few of the key options that may need to be changed to adapt the default amd behavior for a particular site. • normalize_hostnames: Setting this option to yes will cause amd to re-write any hostnames into their fully qualified form before using them as parameters in map files. This is not always desirable as it makes for long entries in map files for local hosts. • log_file: This specifies the location of the log file amd writes messages to. Or, as shown here, the log_file option can be set to “syslog” to have amd log via the syslog service. Automating File Sharing
map_type: This option takes several values allowing for a wide variety of sourcs for map information. Here the “file” option is used. Other choices include hesiod, ldap, ndbm, nis, nisplus, passwd and union. The passwd option allows for the direct creation of an auto_home style user home directory map from the the password file. • browsable_dirs: By setting this to yes, the keys in a given map are made available for viewing by commands such as “ls”. This prevents amd from mounting all the referenced file systems for simple directory lookups; a big performance savings. Note that commands that stat each directory entry such as “ls –l” will still cause amd to mount the referenced file systems. • cache_duration: This specifies the time an unused file system will remain mounted. Automating File Sharing
An amd map file uses a syntax that involves a key and series of values format. The key is the entry that will appear in the amd “file system”. • The series of values describes the file system(s) or other items referenced by the key and their options. • The series of values can contain conditional statements as well as file system references. Automating File Sharing
# global default /defaults type:=nfs;opts:=rw,intr,hard,nosuid,grpid,quota,vers=2,proto=udp # replicated local program servers MISC rhost:=mutant;rfs:=/usr/mutant3/local \ rhost:=turtle;rfs:=/usr/turtle2/local # UNIX filesystems alaska host!=alaska;rhost:=alaska;rfs:=/home \ host==alaska;type:=link;fs:=/home alu host!=alu;rhost:=alu;rfs:=/usr/alu \ host==alu;type:=link;fs:=/usr/alu Automating File Sharing
Windows allows automatic file system mounting. • Windows automounters are fairly simple. • Unix automounters allow for redundancy and failover. • One good use for the automounter is to provide a consistent name space for the users file systems. • Map files are used to configure the Unix automounter. Summary