メインコンテンツまでスキップ

ディレクトリサイズとは何ですか?

Views:
982
Visibility:
Public
Votes:
1
Category:
ontap-9
Specialty:
CORE
Last Updated:

環境

  • ONTAP
  • ディレクトリ

回答

:この場合、「ディレクトリサイズ」というフレーズは、特定のディレクトリ内のすべてのファイルの内容によって使用される合計ディスクスペースには適用されません。  

ディレクトリのサイズを理解するには、最初にディレクトリが実際に何であるかを理解する必要があります。UNIXタイプのオペレーティングシステムには、一般に3つの主要なファイルタイプがあります。 

  • 通常のファイル
  • 特殊ファイル
  • ディレクトリファイル(Directory File)

通常のファイルには、ユーザやアプリケーションによって作成されたデータが格納されます。特殊ファイルについて は、Linux/Unixのファイル形式詳細を参照してください。  この記事では、ディレクトリファイルについて説明します。

ディレクトリファイルとは

ファイルシステムは、すべてのファイルの名前、場所、およびその他のメタデータを追跡します。このメタデータがinodeのみに含まれていた場合、またはファイル自体に含まれていた場合は、ディスクから読み取ってファイルを探すのに非常に長い時間がかかります。このパフォーマンスの問題を軽減するために、ファイル名やその他の必要なメタデータはディレクトリファイルと呼ばれる1つのファイルに保存されます。

注: ファイルのファイルメタデータの内容の例について下記の「追加情報を参照してください。inodeとはですか?

ディレクトリファイルの内容には、次のものが含まれます。

  • ファイル名
  • CIFSで作成されている場合は、DOS 8.3の名前
  • inode番号 
ディレクトリファイルのサイズを確認する方法

ディレクトリファイルのサイズは、1つのディレクトリ内にファイル数の多い環境で重要になります。  最新のファイルシステムでは、長いファイル名とディレクトリ内に多数のファイルを格納できます。  ファイル名の長さと1つのディレクトリ内のファイル数は、いずれもディレクトリファイルのサイズに影響します。

ディレクトリファイルのサイズを確認するには、クライアントから次のコマンドを使用します。 

$ ls -l
-rwxr-xr-x  1 user group    98404 Nov  8  2021 application.png    
drwxr-xr-x  3 user group    4096 Apr 13  2022 backup
-rw-rw-r--  1 user group   2221823 Aug 30  2021 ems.log.0000000009.txt  
-rwxr-xr-x  1 user group   1174298 Feb 12  2020 putty.log
drwxrwxr-x  4 user group    12288 Sep 17  2021 logs

  • この出力の5列目には、各ファイルで使用されているスペースが表示されます。
  • 強調表示されたエントリは、ディレクトリファイルのサイズ(バイト単位)です。
  • 新しく作成されるディレクトリのデフォルトサイズは4096バイトです。
ディレクトリファイルのサイズが大きいと考えられる場合 

ONTAP では、検索にはディレクトリファイルサイズが2MiB以上であるとみなされます。このサイズ以上のディレクトリファイルは、検索パフォーマンスを向上させるために自動的にインデックスが作成されます。

追加情報

$ stat file.dat
  File: file.dat
  Size: 419430400     Blocks: 822432    IO Block: 65536  regular file  
Device: 3bh/59d Inode: 99629125   Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1010/user)   Gid: (   80/   grp)
Context: system_u:object_r:nfs_t:s0
Access: 2017-01-16 04:54:15.115626000 -0800
Modify: 2013-01-09 02:48:00.000000000 -0800
Change: 2017-01-16 04:54:15.116631000 -0800
 Birth: -

  • ディレクトリファイルメタデータの例

  $ stat fspopulate
  File: fspopulate
  Size: 4096       Blocks: 8      IO Block: 32768  directory    
Device: 3bh/59d Inode: 89991994   Links: 4
Access: (2755/drwxr-sr-x)  Uid: ( 1010/user)   Gid: (   80/   grp)
Context: system_u:object_r:nfs_t:s0
Access: 2022-05-30 03:45:53.110149000 -0700
Modify: 2017-01-16 04:54:15.538648000 -0800
Change: 2017-01-16 04:54:15.538648000 -0800
 Birth: -

 

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.