UNIX文件夹已满(df -kh显示为100%)但不会显示任何大文件

时间:2022-06-08 22:09:41

When given df -k /foldername, it shows used% as 100% in an UNIX folder but inside the /foldername when given ls -lbh, there are no bigger files inside.

当给出df -k / foldername时,它在UNIX文件夹中显示%%为100%但在给定ls -lbh时在/ foldername中显示,内部没有更大的文件。

4 个解决方案

#1


Note: UNIX filesystems have an interesting feature: a process can open a file, then the same process (or another one) can "delete" the file. As long as the original process holds the file open, it uses disk space. It cannot be seen in the directory because unlink(), rm, or remove() clobbered it in the directory.

注意:UNIX文件系统有一个有趣的特性:进程可以打开文件,然后相同的进程(或另一个进程)可以“删除”该文件。只要原始进程保持文件打开,它就会使用磁盘空间。它在目录中看不到,因为unlink(),rm或remove()在目录中将其破坏了。

It will be fully deleted if and only if all processes that have the file open, close the file descriptor. (Or the process/processes exit).

当且仅当所有打开文件的进程都关闭文件描述符时,它将被完全删除。 (或者进程/进程退出)。

If you cannot use find to locate really big new files (this find works on almost any UNIX:

如果你不能使用find找到真正重要的新文件(这个发现几乎适用于任何UNIX:

find /path/to/mountpoint -mtime -1 -size +10000 -exec ls -l  {} \;

Then you will have to try fuser or lsof - whichever tool you have. Linux has lsof, most older UNIX implementations have fuser.

然后你将不得不尝试fuser或lsof - 无论你使用哪种工具。 Linux有lsof,大多数旧的UNIX实现都有定影器。

There is also a remote possibility - you mounted another filesystem on top of a directory (on your current filesystem) that already had big files in it. It is possible to do this, almost always by accident. I do not know how to deal with that without umount -ing the filesystem. The files in the covered up directory are literally invisible AFAIK.

还有一种远程可能性 - 您在另一个已经包含大文件的目录(当前文件系统)上安装了另一个文件系统。几乎总是偶然地做到这一点。我不知道如何在不卸载文件系统的情况下解决这个问题。掩盖目录中的文件实际上是不可见的AFAIK。

#2


df tells you the usage of a filesystem, not a folder. You can specify the filesystem by the name of any file or folder on the filesystem, but the numbers printed refer to the filesystem as a whole, not the folder or file specified.

df告诉你文件系统的用法,而不是文件夹。您可以通过文件系统上的任何文件或文件夹的名称指定文件系统,但打印的数字是指整个文件系统,而不是指定的文件夹或文件。

So its likely that the large files using up all the space are in some other folder on the same filesystem

因此,用尽所有空间的大文件可能位于同一文件系统上的某个其他文件夹中

#3


You're probably wanted du -sch .[!.]* * |sort -h — to print all files starting from the current directory recursively and sort it by size. The problem is likely that the big files are in hidden directories that starts with dot, like .config. You may see at these with ls -a.

你可能想要du -sch。[!。] * * | sort -h - 以递归方式打印从当前目录开始的所有文件并按大小排序。问题可能是大文件位于以点开头的隐藏目录中,如.config。你可以用ls -a看到这些。

#4


My favorite tool for tracking down filesystem utilization is ncdu.

我最喜欢的跟踪文件系统利用率的工具是ncdu。

http://dev.yorhel.nl/ncdu

#1


Note: UNIX filesystems have an interesting feature: a process can open a file, then the same process (or another one) can "delete" the file. As long as the original process holds the file open, it uses disk space. It cannot be seen in the directory because unlink(), rm, or remove() clobbered it in the directory.

注意:UNIX文件系统有一个有趣的特性:进程可以打开文件,然后相同的进程(或另一个进程)可以“删除”该文件。只要原始进程保持文件打开,它就会使用磁盘空间。它在目录中看不到,因为unlink(),rm或remove()在目录中将其破坏了。

It will be fully deleted if and only if all processes that have the file open, close the file descriptor. (Or the process/processes exit).

当且仅当所有打开文件的进程都关闭文件描述符时,它将被完全删除。 (或者进程/进程退出)。

If you cannot use find to locate really big new files (this find works on almost any UNIX:

如果你不能使用find找到真正重要的新文件(这个发现几乎适用于任何UNIX:

find /path/to/mountpoint -mtime -1 -size +10000 -exec ls -l  {} \;

Then you will have to try fuser or lsof - whichever tool you have. Linux has lsof, most older UNIX implementations have fuser.

然后你将不得不尝试fuser或lsof - 无论你使用哪种工具。 Linux有lsof,大多数旧的UNIX实现都有定影器。

There is also a remote possibility - you mounted another filesystem on top of a directory (on your current filesystem) that already had big files in it. It is possible to do this, almost always by accident. I do not know how to deal with that without umount -ing the filesystem. The files in the covered up directory are literally invisible AFAIK.

还有一种远程可能性 - 您在另一个已经包含大文件的目录(当前文件系统)上安装了另一个文件系统。几乎总是偶然地做到这一点。我不知道如何在不卸载文件系统的情况下解决这个问题。掩盖目录中的文件实际上是不可见的AFAIK。

#2


df tells you the usage of a filesystem, not a folder. You can specify the filesystem by the name of any file or folder on the filesystem, but the numbers printed refer to the filesystem as a whole, not the folder or file specified.

df告诉你文件系统的用法,而不是文件夹。您可以通过文件系统上的任何文件或文件夹的名称指定文件系统,但打印的数字是指整个文件系统,而不是指定的文件夹或文件。

So its likely that the large files using up all the space are in some other folder on the same filesystem

因此,用尽所有空间的大文件可能位于同一文件系统上的某个其他文件夹中

#3


You're probably wanted du -sch .[!.]* * |sort -h — to print all files starting from the current directory recursively and sort it by size. The problem is likely that the big files are in hidden directories that starts with dot, like .config. You may see at these with ls -a.

你可能想要du -sch。[!。] * * | sort -h - 以递归方式打印从当前目录开始的所有文件并按大小排序。问题可能是大文件位于以点开头的隐藏目录中,如.config。你可以用ls -a看到这些。

#4


My favorite tool for tracking down filesystem utilization is ncdu.

我最喜欢的跟踪文件系统利用率的工具是ncdu。

http://dev.yorhel.nl/ncdu