linux_wiki:auto_mount_network_shares

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
linux_wiki:auto_mount_network_shares [2016/01/04 23:19]
billdozor [Install Required Packages]
linux_wiki:auto_mount_network_shares [2018/03/20 23:51]
billdozor [Direct Map Example]
Line 6: Line 6:
  
 **Checklist** **Checklist**
-  * Enterprise Linux 6/7 +  * Distro(s): Enterprise Linux 6/7 
-  * Network server with shared directory (NFS or CIFS)+  * Other: Network server with shared directory (NFS or CIFS)
  
 ---- ----
Line 30: Line 30:
 ===== Map Files ===== ===== Map Files =====
  
-/etc/auto.master =Main map file.+The master map file contains entries that point to other config files for specific mount instructions. 
 + 
 +  * EL6: /etc/auto.master 
 +  * EL7: /etc/auto.master.d/<name>.autofs 
 +    * In EL7, the "/etc/auto.master" file is part of the RPM; any updates to the autofs package could overwrite changes you make, so it is recommended to create your own master map file under /etc/auto.master.d/. The name does not matter, as long as it ends in ".autofs" 
 + 
 +\\ 
 +Master Map File Contents
   * First column = name of the mount point on the local client system   * First column = name of the mount point on the local client system
   * Second column = config file that controls its mounting   * Second column = config file that controls its mounting
Line 37: Line 44:
 Example Example
 <code bash> <code bash>
-# File: /etc/auto.master+# File: /etc/auto.master OR /etc/auto.master.d/<name>.autofs
  
-/home  /etc/auto.home --timeout=600+# Direct mounts: look in auto.direct for mappings
 /-     /etc/auto.direct /-     /etc/auto.direct
 +
 +# Indirect mounts: look in auto.home for mappings of subdirectories of /home/
 +/home  /etc/auto.home --timeout=600
 </code> </code>
  
-  * Direct Maps => Network file systems that are mounted from different servers or that don't all start with the same file system path on the same server.+  * Direct Maps => One or more full path mounts to one or more remote servers. This is similar to regular NFS mounts that you would see in /etc/fstab.
     * Above example: /-     /etc/auto.direct     * Above example: /-     /etc/auto.direct
-  * Indirect Maps => Directories on the remote server that can all be mounted under the same local mount point.+  * Indirect Maps => Directories on the remote server that can all be mounted under the same local mount point. (IE: All sub directories of the listed local mount "/home")
     * Above example: /home  /etc/auto.home --timeout=600     * Above example: /home  /etc/auto.home --timeout=600
  
Line 52: Line 62:
 ==== Direct Map Example ==== ==== Direct Map Example ====
  
-**Note:** All direct map entries must be defined as "/-" in the auto.master file.+**Note:** All direct map entries must be defined as "/-" in the /etc/auto.master or /etc/auto.master.d/<name>.autofs file.
  
 <code bash> <code bash>
 # File: /etc/auto.direct # File: /etc/auto.direct
 +# Reminder of master map contents for reference:
 +#   /    /etc/auto.direct
  
 +# Direct mappings: local mountpoint from remote mountpoint
 /network-shares/nfs-share    -rw    192.168.1.151:/data/nfs /network-shares/nfs-share    -rw    192.168.1.151:/data/nfs
 /network-shares/nfs-share2   -rw    192.168.1.151:/data/nfs2 /network-shares/nfs-share2   -rw    192.168.1.151:/data/nfs2
Line 74: Line 87:
 <code bash> <code bash>
 # File: /etc/auto.home # File: /etc/auto.home
 +# Reminder of master map contents for reference:
 +#   /home  /etc/auto.home --timeout=600
  
 +# Indirect mappings: sub directories of /home/
 yoda    192.168.1.151:/home/yoda yoda    192.168.1.151:/home/yoda
 luke    192.168.1.151:/home/luke luke    192.168.1.151:/home/luke
Line 92: Line 108:
 *    192.168.1.151:/home/& *    192.168.1.151:/home/&
 </code> </code>
-  * The "&" is replaced by the key in the first column (*) +  * "*" is assigned the directory that is accessed. If someone tried to access "/home/yoda"the "*" value is "yoda"
-  * "*" is assigned the value that triggered access. If someone tried to access /home/lukethen "lukewill be the value of the key in the first column ("*")+  * The "&" in the remote server line is replaced by the key in the first column (*). So if someone accesses local "/home/yoda", the remote system (192.168.1.151gets an access attempt to "/home/yoda"
  
 ---- ----
Line 99: Line 115:
 ===== Start and Enable ===== ===== Start and Enable =====
  
-Start Auto Mounter +Start and Enable Auto Mounter on Boot 
-  * EL7<code bash>systemctl start autofs</code> +  * EL7<code bash>systemctl start autofs 
-  * EL6<code bash>service autofs start</code> +systemctl enable autofs</code> 
- +  * EL6<code bash>service autofs start 
-Enable Auto Mounter on boot +chkconfig autofs on</code>
-  * EL7<code bash>systemctl enable autofs</code> +
-  * EL6<code bash>chkconfig autofs on</code>+
  
-Reload Auto Mount Config (to enable changes)+Reload Auto Mount Config (to enable changes made after service startup)
   * EL7<code bash>systemctl reload autofs</code>   * EL7<code bash>systemctl reload autofs</code>
   * EL6<code bash>service autofs reload</code>   * EL6<code bash>service autofs reload</code>
  • linux_wiki/auto_mount_network_shares.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)