Atime 値は、ファイルの作成後に一度だけ変更されます。

Atime 値は、ファイルの作成後に一度だけ変更されます。

明示的に指定された値atimeを使用してディスクをマウントしました。

mount -o mount -o atime /dev/disk1 /myDisk

その後、ファイルを作成しました。

touch file_A

これを実行した後、統計出力は次のようになります。

Access: 2013-08-30 11:38:48.141970758 +0200
Modify: 2013-08-30 11:38:48.141970758 +0200
Change: 2013-08-30 11:38:48.141970758 +0200

cat /myDisk/file_A統計出力が一度だけ変更された後:

    Access: 2013-08-30 11:39:11.141970758 +0200
    Modify: 2013-08-30 11:38:48.141970758 +0200
    Change: 2013-08-30 11:38:48.141970758 +0200

これにより、catを複数回実行してもアクセス時間の値はまったく変わりません。これは何の問題ですか?このような行動はどこから来るのでしょうか?ファイルに対するすべてのcat操作の後にアクセス時間が変更されると予想します。最初の訪問だけが表示されるのはなぜですか?

(noatimeオプションを使用してディスクをマウントすると、他の動作が発生します。すべての猫は統計のアクセス時間を変更します。まだ変更と変更と同じです)

ベストアンサー1

relatimeインストール中にこのオプションを使用できますか?atimeその間に中程度が必要です。noatimeそうすることで、多くのI / Oは発生しませんが、atime依然として高価ではありませんnoatime

これは次の説明ですman 8 mount

   relatime
   Update  inode  access times relative to modify or change time.  
   Access time is only updated if the previous access time was 
   earlier than the current modify or change time. (Similar to noat‐
   ime, but doesn't break mutt or other applications that need to 
   know if a file has been read since the last time it was modified.)

   Since Linux 2.6.30, the kernel defaults to the behavior provided 
   by this option (unless noatime was  specified), and the 
   strictatime option is required to obtain traditional  semantics. 

   In addition, since Linux 2.6.30, the file's last access time is 
   always  updated  if  it  is more than 1 day old.

おすすめ記事