29
Automating File Sharing Chapter 19

Ch19 system administration

Embed Size (px)

Citation preview

Page 1: Ch19 system administration

Automating File Sharing

Chapter 19

Page 2: Ch19 system administration

Chapter Goals

• Understand how to automount file systems under Windows.

• Understand how to create a consistent name space.

• Understand NFS automounter setup.

• Understand automounter map files.

Page 3: Ch19 system administration

Automating File Sharing• 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.

Page 4: Ch19 system administration

Automating File Sharing• This dialog includes three items to pay careful attention to.

1. 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.

2. 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.

3. 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.

Page 5: Ch19 system administration

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.

Page 6: Ch19 system administration

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.

Page 7: Ch19 system administration

Automating File Sharing

Page 8: Ch19 system administration

Automating File Sharing

Page 9: Ch19 system administration

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.

Page 10: Ch19 system administration
Page 11: Ch19 system administration
Page 12: Ch19 system administration

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

Page 13: Ch19 system administration
Page 14: Ch19 system administration

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:

Page 15: Ch19 system administration

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

Page 16: Ch19 system administration

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

Page 17: Ch19 system administration

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

Page 18: Ch19 system administration

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.

Page 19: Ch19 system administration

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

Page 20: Ch19 system administration
Page 21: Ch19 system administration

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)

Page 22: Ch19 system administration

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.  

Page 23: Ch19 system administration

#

# 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

Page 24: Ch19 system administration

# set map_type to "nis" for NIS maps, or comment it out to search for all# typesmap_type = filesearch_path = /etcbrowsable_dirs = yesshow_statfs_entries = nofully_qualified_hosts = nocache_duration = 3600local_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

Page 25: Ch19 system administration

Automating File Sharing• 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.

Page 26: Ch19 system administration

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.

Page 27: Ch19 system administration

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.

Page 28: Ch19 system administration

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

Page 29: Ch19 system administration

Summary

• 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.