破損したNFSマウントが原因でディレクトリがロックされないようにしますか?

破損したNFSマウントが原因でディレクトリがロックされないようにしますか?

やや興味深い設定があります。フォルダに複数のリモートNFSサーバーがあるサーバーをマウントし、Samba経由でフォルダを再エクスポートします。すべての共有フォルダを1か所に保持する共有プロキシだと思います。

しかし、私の問題は、マウントの1つが失敗するたびに(サーバーの再起動、サービスの再起動、サーバーからエクスポートされた外付けハードドライブの取り外しなど)、マウントを読み取ろうとする試みが永久にブロックされることです。これはまた、lsSamba経由で接続しているユーザーと同様に、そのディレクトリでの実行が停止されることを意味します。これにより、クローン操作が何度もブロックされ、何百ものプロセスがブロックされ、サーバーがほとんどクラッシュする可能性があります。通常ls、完了を待たない(キャンセルできない)ターミナルを開き、実行して動作することを望み、for i in *; do sudo umount -l -f $i; done;問題を解決してからすべてを再インストールする必要があるため、これは非常に迷惑です。

NFS共有をマウントし、何らかの理由で接続が失敗した場合(再試行期間が望ましい場合)、マウントがそれ自体でアンマウントまたは少なくともブロックされないようにする方法はありますか?

ベストアンサー1

通常、NFSをマウントするときは、次のようなフラグを設定することをお勧めします。

bg,intr,soft
   bg      If  the  first  NFS  mount  attempt times out, retry the mount in the 
           background.  After a mount operation is backgrounded, all subsequent mounts
           on the same NFS  server  will  be  backgrounded immediately, without first
           attempting the mount.  A missing mount point is treated as a timeout, to
           allow for nested NFS mounts.
   soft    If  an  NFS  file operation has a major timeout then report an I/O error
           to the calling program.  The default is to continue retrying NFS file
           operations indefinitely.
   intr    If  an  NFS  file  operation  has  a major timeout and it is hard mounted,
           then allow signals to interupt the file operation and cause it to return
           EINTR to the calling program.  The default is to not allow file operations
           to be interrupted.

以下を設定することもできます。

timeo=5,retrans=5,actimeo=10,retry=5

NFSサーバーが再試行を待たずに接続を切断すると、NFSマウントがタイムアウトし、ディレクトリにアクセスできなくなります。

見てこのリンクNFS マウントオプションの詳細

おすすめ記事