文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Mounting a Remote Directory

Mounting a Remote Directory

时间:2006-07-11  来源:飞天二狭

   

This section provides detailed information on how to mount a remote directory using both the direct and indirect AutoFS maps.

 

Using a Direct AutoFS Map

To mount a remote directory using a direct AutoFS map, perform the following steps:

  1. If you are using local files for your AutoFS maps, use an editor to open or create a direct map in the /etc directory. The direct map is commonly called /etc/auto_direct. Add a line to the direct map with the following syntax:

    local_directory [mount_options] server:remote_directory

    For CIFS file system mount entries in AutoFS direct map files, set the mount option for the fstype file system type to cifs. The remote server must be a CIFS server, and the remote directory must be a CIFS share.

    If you are using NIS to manage your AutoFS maps, add the line to the direct map on the NIS master server. See the "Configuring and Administering NIS" chapter of NFS Services Administrator's Guide.

  2. If you are using local files for your AutoFS maps, use an editor to open or create the AutoFS master map in the /etc directory. You need to name the master map as /etc/auto_master. If you are using NIS, open the master map on the NIS master server.

    If the direct map you just modified is not listed in the AutoFS master map, add the following line to the master map:

    /-  direct_map_name  [mount_options]
  3. If you are using NIS to manage your AutoFS maps, issue the following commands on the NIS master server to rebuild the maps, and push them to the slave servers:

    cd /var/yp
    /usr/ccs/bin/make auto_master auto_direct
  4. On each host that will use the map you have modified, issue the following command to force AutoFS to read the modified map:

    /usr/sbin/automount

The local directory that you configure as the mount point should be empty or non-existent. AutoFS creates the non-existent directories between the root directory and the configured mount point. If the local directory that you configured as the mount point is not empty, the local files or directories in it are hidden and inaccessible while the automounted file system is mounted over it.

Warning! Do not automount a remote directory on a local directory that is a symbolic link.

If you are using NIS to manage your AutoFS maps, you need to be careful of situations where the NIS server is also a server from which file systems are automounted. If the mount point specified by the NIS map is the same as the actual source directory on the server, AutoFS may attempt to mount the source directory over itself when a user accesses the mount point on the NIS server. This may cause the directory to become unavailable.

The mount options that you can specify in the AutoFS maps are the same ones that you use for the type of file system you attempt to automount. For more information on the mount options, see the "Changing the Default Mount Options" section of NFS Services Administrator's Guide. You cannot use the bg option for an automounted directory. The mount options configured in the direct map override the options in the master map if there is a conflict.

You can configure all your direct automounts in the same map. Many users use the file name, /etc/auto_direct, for their direct map. If you plan to use NIS to manage your AutoFS maps, you can have only one direct map in your configuration. If you plan to use NIS to manage your AutoFS maps, and your file system does not allow file names longer than 14 characters, restrict the map name to 10 characters or fewer.

If the direct map name in the AutoFS master map begins with a slash (/), it is a local file for AutoFS. If the direct map does not contain a slash, AutoFS uses the Name Service Switch to determine whether it is a file or an NIS map. See the "Configuring the Name Service Switch" chapter of NFS Services Administrator's Guide.

Before you can mount a remote directory on your system, ensure that you configure the remote system where the directory is located as an NFS server. In addition, ensure that you export the directory.

You must enable AutoFS before any directory is automounted. Automounted directories stay mounted until they are idle for 10 minutes. You can change the 10-minute default time by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf file or by running the automount command with the -t option from the command line.

If you change the mount options, the remote server name, or the remote directory name for an existing direct mount, while AutoFS is running, the changes you made will take effect the next time the directory is mounted. However, if you change the local directory name in the direct map, or if you change the master map, these changes will not take effect until you issue the automount command to force AutoFS to reread its maps.

For more information on AutoFS configuration, see the automount(1M) man page.

Warning! File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed file systems can lead to disruptive or unpredictable results, including but not limited to the following:

  • Commands hang or do not return expected results.

  • Applications fail due to their dependencies on these mounted file systems.

 

Sample File Entries for NFS Direct Automounts

The following example contains sample lines from an AutoFS direct map on the NFS client, sage. The sharp sign (#) indicates a comment line.

# /etc/auto_direct file
# local mount point mount options remote server:directory

/auto/project/specs -nosuid thyme:/export/project/specs
/auto/project/budget -nosuid basil:/export/FY94/proj1

The following example contains sample lines from the AutoFS master map on the NFS client, sage.

# /etc/auto_master file
# local mount point map name mount options

/- /etc/auto_direct

Figure 3-6, “Example of Direct Mounts” illustrates how AutoFS sets up the direct mounts for this configuration.

Figure 3-6. Example of Direct Mounts

 

Using an Indirect AutoFS Map

To mount a remote directory using an indirect AutoFS map, perform the following steps:

  1. If you are using local files for your AutoFS maps, use an editor to open or create an indirect map in the /etc directory. Add a line with the following syntax to the indirect map:

    local_subdirectory [mount_options] server:remote_directory

    For CIFS file system mount entries in AutoFS indirect map files, you must set the mount option for the fstype file system type to cifs.The remote server must be a CIFS server, and the remote directory must be a CIFS share.

    If you are using NIS to manage your AutoFS maps, add the line to an indirect map on the NIS master server. See the "Configuring and Administering NIS" chapter of NFS Services Administrator's Guide.

  2. If you are using local files for your AutoFS maps, use an editor to open or create the AutoFS master map in the /etc directory. You need to name the master map as /etc/auto_master. If you are using NIS, open the master map on the NIS master server.

    If the indirect map you modified is not listed in the AutoFS master map, add the following line to the master map:

    local_parent_directory indirect_map_name [mount_options]
  3. If you are using NIS to manage your AutoFS maps, issue the following commands on the NIS master server to rebuild the maps, and push them to the slave servers:

    cd /var/yp
    /usr/ccs/bin/make auto_master indirect_mapname
  4. If you modified the AutoFS master map, issue the following command on each host that will use the map. This forces AutoFS to read the modified master map:

    /usr/sbin/automount

The local_subdirectory specified in the indirect map is the deepest subdirectory in the local directory path name. For example, if you were mounting a remote directory on /nfs/apps/draw, the local_subdirectory specified in the indirect map is draw.

The local_parent_directory specified in the master map is all but the deepest subdirectory in the local directory path name. For example, if you were mounting a remote directory on /nfs/apps/draw, the local_parent_directory specified in the master map is /nfs/apps.

The local_parent_directory and local_subdirectory should not exist; AutoFS creates them when it mounts the remote directory. If the local_parent_directory or local_subdirectory contains files or directories, they are hidden beneath the remote directory when it is mounted.

Warning! The local_subdirectory and local_parent_directory must not be symbolic links.

If you are using NIS to manage your AutoFS maps, make sure the local mount point is different from the exported directory on the server. If they are same, the server may attempt to mount its exported directory over itself, and the directory will become unavailable.

The mount options that you can specify in the AutoFS maps are the same ones that you use for the type of filesystem you attempt to automount. For a list of mount options, see the "Changing the Default Mount Options" section of NFS Services Administrator's Guide. You cannot use the bg option for an automounted directory. The mount options configured in the indirect map override the ones in the master map if there is a conflict.

You can configure indirect automounts in the same indirect map only if their local_parent_directory, as specified in the AutoFS master map, is the same. For example, you can configure indirect mounts with the local mount points, /nfs/apps/draw and /nfs/apps/word, in the same indirect map.

Indirect maps are usually called /etc/auto_name, where name helps you in identifying what is configured in the map. If you plan to use NIS to manage your AutoFS maps, and if your file system does not support file names longer than 14 characters, restrict your indirect map names to 10 characters or fewer.

If the indirect map name in the AutoFS master map begins with a slash (/), then it is a local file for AutoFS. If it does not contain a slash, AutoFS uses the Name Service Switch to determine whether it is a file or an NIS map. See "Configuring the Name Service Switch" chapter of NFS Services Administrator's Guide.

Before you can mount a remote directory on your system, ensure to configure the remote system where the directory is located as an NFS server. In addition, make sure to export the directory.

Automounted directories stay mounted until they are idle for ten minutes. You can change the ten-minute default time by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf file or by running the automount command with the -t option from the command line.

You must enable AutoFS before any directory is automounted. See  "Enabling Enhanced AutoFS" .

If AutoFS is already running when you add an indirect mount to your configuration, you do not have to run the automount command unless you change the master map. The changes you make to an existing indirect map take effect when AutoFS mounts the directory the next time. However, changes to the master map will not take effect until you issue the automount command to force AutoFS to reread its maps.

For more information on the AutoFS configuration, see the automount(1M) man page.

Warning! File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed file systems can lead to disruptive or unpredictable results, including but not limited to the following:

  • Commands hang or do not return expected results.

  • Applications fail due to their dependencies on these mounted file systems.

 

Sample File Entries for NFS Indirect Automounts

The following example contains sample lines from an AutoFS indirect map on the NFS client, sage. The sharp sign (#) indicates a comment. AutoFS ignores everything from the sharp sign to the end of the line.

# /etc/auto_desktop file
# local mount point mount options remote server:directory

draw -nosuid thyme:/export/apps/draw
write -nosuid basil:/export/write

The following example contains sample lines from the AutoFS master map on the NFS client, sage. The master map also includes an entry for the direct map, /etc/auto_direct.

# /etc/auto_master file
# local mount point map name mount options

/- /etc/auto_direct
/nfs/desktop /etc/auto_desktop

Figure 3-7, “Example of Indirect Mounts” illustrates how AutoFS sets up the indirect mounts for this configuration.

Figure 3-7. Example of Indirect Mounts



Deciding Between Direct and Indirect NFS Automounts 
 

Executable Maps  
相关阅读 更多 +
排行榜 更多 +
龙珠格斗火柴人

龙珠格斗火柴人

飞行射击 下载
荒野恐龙猎手安卓版

荒野恐龙猎手安卓版

飞行射击 下载
超凡坦克英雄

超凡坦克英雄

飞行射击 下载