Go to main content

Managing Network File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: August 2021
 
 

How to Consolidate Project-Related Files Under a Common Directory

You can use autofs to consolidate files in a directory that is common across multiple systems. You can add the directory structure of the project-related files to the autofs map for the common directory. This directory structure enables the users to use the project files irrespective of physical and hardware changes in the systems.

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.

  2. Add an entry for the common directory to the auto_master map.
    /common-dir     auto_common-dir     -nosuid

    The auto_common-dir map determines the contents of the common directory.

  3. Add the -nosuid option as a precaution to prevent users from running the setuid programs that might exist in any workspace.
  4. Add entries to the auto_common-dir map.

    The auto_common-dir map is organized so that each entry describes a subproject. Your first attempt yields a map that resembles the following:

    project1   system1:/export/common-dir/&
    project2    system1:/export/common-dir/&
    app1      system2:/export/common-dir/&

    The ampersand (&) at the end of each entry is an abbreviation for the entry key.

Example 7  Consolidating Project-Related Files Under /ws

Assume that you are the administrator of a large software development project. You plan to make all project-related files available under a directory that is called /ws. This directory is to be common across all workstations at the site.

Add an entry for the /ws directory to the site auto_master map.

/ws     auto_ws     -nosuid 

The auto_ws map determines the contents of the /ws directory. The –nosuid prevents users from running setuid programs that might exist in any workspaces. Add entries to the auto_ws map such that each entry describes a subproject. Your first attempt yields a map that resembles the following:

compiler   alpha:/export/ws/&
windows    alpha:/export/ws/&
files      bravo:/export/ws/&
drivers    alpha:/export/ws/&
man        bravo:/export/ws/&
tools      delta:/export/ws/&

The ampersand (&) at the end of each entry is an abbreviation for the entry key. For instance, the first entry is equivalent to the following:

compiler		alpha:/export/ws/compiler 

This first attempt provides a map that appears simple, but additional refinements are necessary. The project organizer decides that the documentation in the man entry should be provided as a subdirectory under each subproject. Also, each subproject requires subdirectories to describe several versions of the software. You must assign each of these subdirectories to an entire disk partition on the server.

Modify the entries in the map as follows:

compiler \
    /vers1.0    alpha:/export/ws/&/vers1.0 \
    /vers2.0    bravo:/export/ws/&/vers2.0 \
    /man        bravo:/export/ws/&/man
windows \
    /vers1.0    alpha:/export/ws/&/vers1.0 \
    /man        bravo:/export/ws/&/man
files \
    /vers1.0    alpha:/export/ws/&/vers1.0 \
    /vers2.0    bravo:/export/ws/&/vers2.0 \
    /vers3.0    bravo:/export/ws/&/vers3.0 \
    /man        bravo:/export/ws/&/man
drivers \
    /vers1.0    alpha:/export/ws/&/vers1.0 \
    /man        bravo:/export/ws/&/man
tools \
    /           delta:/export/ws/&

Although the map now appears to be much larger, the map still contains only the five entries. Each entry is larger because each entry contains multiple mounts. For instance, a reference to /ws/compiler requires three mounts for the vers1.0, vers2.0, and man directories.

The backslash at the end of each line indicates that the entry is continued onto the next line. Effectively, the entry is one long line, though line breaks and some indenting have been used to make the entry more readable.

The tools directory contains software development tools for all subprojects, so this directory is not subject to the same subdirectory structure. The tools directory continues to be a single mount.

This arrangement provides the administrator with much flexibility. Software projects typically consume substantial amounts of disk space. Through the life of the project, you might be required to relocate and expand various disk partitions. If these changes are reflected in the auto_ws map, you do not need to notify the users because the directory hierarchy under /ws is not changed.

Because the servers alpha and bravo view the same autofs map, any users who log in to these systems can find the /ws namespace as expected. These users are provided with direct access to local files through loopback mounts instead of NFS mounts.