断片化は、HDDのディレクトリツリーをナビゲートするときに不要な検索をたくさん生成するようです。
# stat -c %F 00 01 02
directory
directory
directory
# filefrag -v 00 01 02
Filesystem type is: ef53
File size of 00 is 12288 (3 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 428351942.. 428351942: 1:
1: 1.. 2: 428352760.. 428352761: 2: 428351943: last,eof
00: 2 extents found
File size of 01 is 12288 (3 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 428351771.. 428351771: 1:
1: 1.. 2: 428891667.. 428891668: 2: 428351772: last,eof
01: 2 extents found
File size of 02 is 12288 (3 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 428351795.. 428351795: 1:
1: 1.. 2: 428352705.. 428352706: 2: 428351796: last,eof
02: 2 extents found
e4defragはデフラグできません
# e4defrag -v 00
ext4 defragmentation for directory(00)
[1/116] "00"
File is not regular file [ NG ]
それでは、ディレクトリの最適化はどうなりますか?内容ではなく、ディレクトリ自体です。これらのディレクトリは使用中であるため、通常のファイルの最適化が使用を妨げないように原子的に実行する必要があります。
ベストアンサー1
ディレクトリインデックス作成のためのオンラインデフラグツールがないようで、オフラインデフラグも役に立たないようだったので、ディレクトリツリーを再帰的に再構築する必要がありました。
私は小さなツールを書いた(デフラグディレクトリ)この目的のために。残念ながら、この方法を使用するには、デフラグ中にディレクトリツリーを使用するアプリケーションを削除する必要があるため、数百万のファイルを操作するのに時間がかかることがあります。