GNU/Linux >> Linux の 問題 >  >> Cent OS

CentOS/RHEL で「autofs」を使用して NFS ファイル システムをマウントする方法

この投稿では、「autofs」サービスを使用して NFS ファイル システムをマウントするために「autofs」を構成する方法について説明します。

1.「autofs」サービスを停止し、サービスが実行されているかどうかを確認してから、停止に進みます。

# service autofs status
automount (pid 25285) is running...
# service autofs stop
Stopping automount: [ OK ]
# service autofs status
automount is stopped

2. /etc/auto.master を編集します ファイルマップを設定するファイル:

ファイル /etc/auto.master は、「autofs」サービスのメイン構成ファイルです。このファイルには、「autofs」によって制御されるシステム上のマウント ポイントのマスター マップ リストと、既知の対応する構成ファイルまたはネットワーク ソースが含まれています。 「オートマウント マップ」として '。

ファイルは次のようになります:

# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc     ---------------------> MAP FILE
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master

「マップ ファイル」は、/etc の下にある「auto.mount」という名前の他のファイルに変更して、エクスポートを他の目的のディレクトリにマウントすることができます。詳細については、ステップ 2 に進んでください。

auto.master」を編集します ‘ ファイルを開き、「/misc /etc/auto.misc」の行の前にハッシュ記号を追加してから、次の行をファイルの最後に追加します:

/- /etc/auto.mount

変更後のファイルは次の例のようになります:

#
# /misc /etc/auto.misc
#
/- /etc/auto.mount

3. マップ ファイルを作成および/または編集します。

マップ ファイルは、指定されたマウント ポイントにマウントされるファイル システムを定義する別のファイルです。たとえば、/etc/auto.misc ファイルは、/misc ディレクトリにマウント ポイントを定義する場合があります。もう 1 つの例は、エクスポートをマウントする別のディレクトリとして /mnt を使用することです。他のディレクトリが必要な場合は、推奨事項として「auto.mount」という名前の新しいファイルを /etc/ ディレクトリの下に作成する必要があります。

以下は「/etc/auto.misc」ファイルと新しいファイル「auto.mount」の例です

# This is an automounter map and it has the following format
# key(mount-point) [ -mount-options-separated-by-comma ] location   ===> THIS IS THE GENERAL FORMAT OF THE MAPS
# Details may be found in the autofs(5) manpage

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom  ===> EXAMPLE

# the following entries are samples to pique your imagination
#linux -ro,soft,intr ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd

mount_point_name      -rw,soft,intr,rsize=8192,wsize=8192       NFS.example.net:/export_name  ===> IP address can be used instead of the FQDN

/misc ディレクトリも「auto.misc」ファイルも使用しない場合は、「auto.mount」という名前の新しいファイルを作成し、次の例のように、対応する構文で同じパラメーターを追加します。

# vi /etc/auto.mount

次の行を追加します:

/mount_point -fstype=nfs,rw NFS.example.net:/export_name
注意 :「/etc/auto.master」ファイルを編集したことを確認し、マップ ファイルを目的のファイルに変更します。

4.「autofs」サービスを開始します:

# service autofs start
Starting automount: [ OK ]

5.「mount」コマンドを実行して、NFS 共有がマウントされていることを確認します。

# mount
NFS_IP_Address:/export on /mount_point  type nfs (rw,vers=4,addr=NFS_IP_Address,clientaddr=local_IP_Address)


Cent OS
  1. CentOS/RHEL/Ubuntu に SSHFS をインストールする方法

  2. CentOS / RHEL :スワップ ファイルを追加する方法

  3. CentOS / RHEL :UUID を使用してファイルシステムをマウントする方法

  1. autofsを使用してNFS共有をマウントする方法

  2. CentOS 7 /Rhel7でautofsデーモンを構成する方法

  3. CentOS 7 /RHEL7でNFSサーバーをセットアップする方法

  1. CentOS/RHEL 6,7 で Auditd を使用してマウント ポイントのマウント/アンマウントを監視する方法

  2. CentOS/RHEL:YUM を使用してファイルが欠落しているパッケージを見つける方法

  3. CentOS/RHEL で NFS クライアントのキャッシュを無効にする方法