私のinodeはどこに行きましたか?

私のinodeはどこに行きましたか?

私のルートファイルシステムにinodeが不足しています。ディスクスペースの問題の場合は、それを使用してdu -sスペースがどこに行くかについてのトップレベルの概要を取得し、ディレクトリツリーに沿って特定の違反者を見つけます。 inodeに対応するオプションはありますか?

この質問に対する答え使用率が高い個々のディレクトリが指摘されていますが、私の場合はこれはうまくいきません。たとえば、Linuxソースディレクトリは/usr/src/linux-4.0.5 52183

ベストアンサー1

バージョン8.22以降、GNU coreutils(Linux、Cygwin)を使用すると、du --inodeslcd047で指摘されているように使用できます。

最新のGNU coreutilsがなく、ツリーにハードリンクがない場合、または各リンクが一度計算されるかどうかを問わない場合は、フィルタ処理された出力で同じ番号を取得できますfind。同等のものが必要な場合、du -sつまり最上位ディレクトリだけを望む場合にすべきことは、各最上位ディレクトリ名の行数を数えることだけです。ファイル名に改行がなく、現在のディレクトリにドットではないディレクトリのみが必要であるとします。

find */ | sed 's!/.*!!' | uniq -c

各ディレクトリ(サブディレクトリを含む)の数とともにすべてのディレクトリの出力を表示するには、いくつかの算術演算を実行する必要があります。

find . -depth | awk '{
    # Count the current depth in the directory tree
    slashes = $0; gsub("[^/]", "", slashes); current_depth = length(slashes);
    # Zero out counts for directories we exited
    for (i = previous_depth; i <= current_depth; i++) counts[i] = 0;
    # Count 1 for us and all our parents
    for (i = 0; i <= current_depth; i++) ++counts[i];
    # We don´t know which are regular files and which are directories.
    # Non-directories will have a count of 1, and directories with a
    # count of 1 are boring, so print only counts above 1.
    if (counts[current_depth] > 1) printf "%d\t%s\n", counts[current_depth], $0;
    # Get ready for the next round
    previous_depth = current_depth;
}'

おすすめ記事