メインコンテンツへスキップ

.nfsXXXXファイルとは何で、どのように削除できますか?

Views:
8,185
Visibility:
Public
Votes:
6
Category:
ontap-9
Specialty:
nas
Last Updated:

環境

NFS

回答

  • .nfsXXXXのような命名規則を持つファイルは、クライアントで現在開いているファイルがそのクライアントによって削除されたときにNFSクライアントによって作成されます
  • クライアントはファイルの名前を.nfsXXXX に変更し、これは他のクライアントやプロセスがそのファイルを利用するのを妨げます
  • 名前を変更したクライアントは、そのファイルがクライアントプロセスによって閉じられた後に削除する必要があります。この削除は、クライアントが切断された場合、リブートされた場合、または削除を発行するプロセスが終了した場合には行われないことがあります
  • これらのファイルはONTAPプロセスによって生成されるものではなく、クライアントの要求に応じてのみ作成されます
  • NFSクライアントとプロセスを.nfsxxxxファイルを使って見つけるのは非常に時間がかかる場合があります
  • そのファイルを含むNFS共有にアクセスする可能性のあるすべてのNFSクライアントで、すべてのプロセスを確認する必要があります
  • lsofなどのユーティリティを使用して、.nfsxxxxファイルを使用しているプロセスを特定することができます
  • .nfsXXXXファイルが作成されないようにするには、ファイルが開いているときに削除しないでください
  • .nfsxxxxファイルが使用されていないと判断された場合は、削除してもかまいません。削除によって新しい.nfsxxxxファイルが作成される場合は、そのNFSクライアント上のプロセスがそのファイルを開いています
  • .nfsxxxxファイルの作成と削除のデモンストレーション:
  1. NFSクライアントから、マウントされたNFS共有にファイルを作成し、tailコマンドで開きます
    • ctrl-zでプロセスを中断するか、新しいターミナルを開いて残りのデモを完了します

      shell# echo test > foo
      shell# tail -f foo
      test
      ^Z
      [1]+ Stopped tail -f foo

       
  2. ファイル foo を削除して、NFSクライアントが .nfsxxxx ファイルを作成するようにします

    shell# rm foo
    shell# ls -A
    .nfs5ACF

     
  3. 以降の rm コマンドでは、NFSクライアントが再度ファイル名を変更するだけであることを確認します

    shell# rm .nfs5ACF
    shell# ls -A
    .nfs6ACF

     
  4. lsofまたはfuserを使用して、ファイルを開いているプロセスを特定します

    shell# lsof ./.nfs6ACF
    COMMAND   PID USER   FD   TYPE DEVICE  SIZE NODE NAME
    tail   25725 root   3r   REG   8,1 27603 6647 .nfs6ACF

    shell# fuser .nfs6ACF
    .nfs6ACF 25725o

  5. 最後に、ファイルを開いたままのプロセスを終了し、.nfsxxxファイルが削除されたことを確認します

    shell# kill 25725
    shell# ls -al
    total x
    drwxr-sr-x  2 root src   400 Mar 29 15:39 .
    drwxrwsr-x 36 root src   3336 Mar 21 09:37 ..

追加情報

  • クライアントがファイルを開いているかどうかをONTAPから判別できるかどうかは、使用するプロトコルによって異なります:
    • NFSv3:通常はロックは存在しません。NFSv3はステートレスです。
    • NFSv4.0または4.1:クライアントがファイルを開いている場合、nfsv4 または nfsv4.1 ロックが存在します。
      • cluster2::> vserver locks show -vserver svm1 -volume unix -path /unix/.nfs000000000000006000000009
        Vserver: svm1
        Volume   Object Path               LIF         Protocol  Lock Type   Client
        -------- ------------------------- ----------- --------- ----------- ----------
        unix     /unix/.nfs000000000000006000000009
                                           svm1_cifs_nfs_lif1
                                                       nfsv4     share-level 10.64.24.10
                        Sharelock Mode: write-deny_none

    • ファイルにnfsv4またはnfsv4.1ロックが存在する場合にのみ、クライアントIPを特定できます。
    • ロックが存在しない場合、NFSv3クライアントがファイルを使用しているかどうかを表示するコマンドはありません。
  • FlexGroupsを使用して、ONTAPディレクトリを非同期的に削除するクライアント権限を管理する

:9.8より前のONTAPリリースでは、nfsv4およびnfsv4.1タイプのロックのクライアントIPを取得するには、追加のdiagモードコマンドが必要です。

Please contact NetApp Technical Support or log into the NetApp Support Site to create a case. Reference this article for assistance with the solution. 

  • The solution requires Diagnostic-level recovery. 
  • The use of Diagnostic commands and recovery steps is potentially disruptive and should only be used with guidance from NetApp Support. 

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.