Differences
This shows you the differences between two versions of the page.
linux_wiki:auto_mount_network_shares [2018/03/20 23:51] billdozor [Direct Map Example] |
linux_wiki:auto_mount_network_shares [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Auto Mount Network Shares ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Automatically mounting network shares with autofs. This is the client configuration and assumes a working server setup with NFS or CIFS shares already. | ||
- | |||
- | **Checklist** | ||
- | * Distro(s): Enterprise Linux 6/7 | ||
- | * Other: Network server with shared directory (NFS or CIFS) | ||
- | |||
- | ---- | ||
- | |||
- | ====== Install Required Packages ====== | ||
- | |||
- | **Pre-reqs: | ||
- | * Assuming that all client/ | ||
- | * [[linux_wiki: | ||
- | * [[linux_wiki: | ||
- | \\ | ||
- | |||
- | Install autofs | ||
- | <code bash> | ||
- | yum install autofs | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Autofs Config ====== | ||
- | |||
- | ===== Map Files ===== | ||
- | |||
- | The master map file contains entries that point to other config files for specific mount instructions. | ||
- | |||
- | * EL6: / | ||
- | * EL7: / | ||
- | * In EL7, the "/ | ||
- | |||
- | \\ | ||
- | Master Map File Contents | ||
- | * First column = name of the mount point on the local client system | ||
- | * Second column = config file that controls its mounting | ||
- | * Third column (optional) = default mount options for all mounts defined in config file | ||
- | |||
- | Example | ||
- | <code bash> | ||
- | # File: / | ||
- | |||
- | # Direct mounts: look in auto.direct for mappings | ||
- | /- / | ||
- | |||
- | # Indirect mounts: look in auto.home for mappings of subdirectories of /home/ | ||
- | /home / | ||
- | </ | ||
- | |||
- | * 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: /- / | ||
- | * 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 "/ | ||
- | * Above example: /home / | ||
- | |||
- | ---- | ||
- | |||
- | ==== Direct Map Example ==== | ||
- | |||
- | **Note:** All direct map entries must be defined as "/ | ||
- | |||
- | <code bash> | ||
- | # File: / | ||
- | # Reminder of master map contents for reference: | ||
- | # / | ||
- | |||
- | # Direct mappings: local mountpoint from remote mountpoint | ||
- | / | ||
- | / | ||
- | / | ||
- | </ | ||
- | * First column => local mount point | ||
- | * Second column => mount options | ||
- | * Third column => remote shared directory | ||
- | |||
- | ---- | ||
- | |||
- | ==== Indirect Map Example ==== | ||
- | |||
- | **Note:** This example works best when implemented using LDAP authentication to ensure that user id's are matched up between NFS server and clients. | ||
- | |||
- | Naming local and remote directories | ||
- | <code bash> | ||
- | # File: / | ||
- | # Reminder of master map contents for reference: | ||
- | # / | ||
- | |||
- | # Indirect mappings: sub directories of /home/ | ||
- | yoda 192.168.1.151:/ | ||
- | luke 192.168.1.151:/ | ||
- | vader | ||
- | </ | ||
- | \\ | ||
- | |||
- | Naming local only (Ampersand Wildcard) | ||
- | <code bash> | ||
- | yoda 192.168.1.151:/ | ||
- | </ | ||
- | * The "&" | ||
- | \\ | ||
- | |||
- | All wild cards (Asterisk and Ampersand Wildcards) | ||
- | <code bash> | ||
- | * 192.168.1.151:/ | ||
- | </ | ||
- | * " | ||
- | * The "&" | ||
- | |||
- | ---- | ||
- | |||
- | ===== Start and Enable ===== | ||
- | |||
- | Start and Enable Auto Mounter on Boot | ||
- | * EL7<code bash> | ||
- | systemctl enable autofs</ | ||
- | * EL6<code bash> | ||
- | chkconfig autofs on</ | ||
- | |||
- | Reload Auto Mount Config (to enable changes made after service startup) | ||
- | * EL7<code bash> | ||
- | * EL6<code bash> | ||
- | |||
- | ---- | ||