首页 > 解决方案 > Disk Free decrease in a directory containing only live lucene indexes

问题描述

I'm running a lucene based application on a linux system.

The application writes and read many lucene indexes under the same directory, which doesn't contain other data.

We are monitoring the indexes directory and we noticed that the disk usage as calculated by the df util grows more rapidly than that calculated by the du util.

When we terminate the application the disk usage calculated with the two utils is the same and it is the one calculated with du when the application is running.

Can you figure out which is the reason?

标签: javalinuxlucenefilesystems

解决方案


du 通过遍历文件目录并将所有文件大小相加来计算磁盘使用量。

df 通过读取文件表索引来计算磁盘使用率。

确保以 sudo 的身份运行 du 以获得更好的读数,以便该实用程序可以访问系统上的所有文件。df 计算的可用空间比 du 少,因为 du 在进行计算时可能无法访问系统上的所有文件。

应用程序必须在运行时将一些受读保护的文件写入文件系统,并在退出时将其删除。

为了验证情况是否如此,可以使用可以监控磁盘写入的软件来分析应用程序。在 Windows 上,我会使用进程监视器和过滤器来创建/写入文件。我在 linux 上找到了一个类似的工具来做这件事,叫做Monks。不要在生产服务器上运行它。这可以帮助您找到应用程序写入的文件,并进一步发现是否有任何文件被读锁定。


推荐阅读