我所在的实验室拥有共享的科学计算环境。我的系统管理员刚刚告诉实验室中的每个人,我正在使用的节点之一即将崩溃,因为/tmp已满。我一直试图了解我是如何使用的,/tmp但很困惑。我注意到运行lsof +D /tmp显示了许多打开的文件,根据输出的 NAME 列中的条目,这些文件似乎不在或其/tmp任何子目录中(并且未在 的输出中列出ls /tmp),但仍被包含在内在命令输出中。例如,这是输出的一部分:
(base) lsof -u cigoe +d /tmp 2>/dev/null \nCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME \nbash 81648 cigoe cwd DIR 253,2 4096 34238020 /home/scratch/cigoe/2022/proposal \nbash 81648 cigoe rtd DIR 253,0 4096 128 / bash 81648 cigoe txt REG 253,0 1150648 3646 /usr/bin/bash \nbash 81648 cigoe mem REG 253,0 2586930 3602 /usr/lib/locale/en_US.utf8/LC_COLLATE \nbash 81648 cigoe mem REG 253,0 9253600 201909537 /var/lib/sss/mc/passwd \nbash 81648 cigoe mem REG 253,0 46320 67889113 /usr/lib64/libnss_sss.so.2 \n...\nRun Code Online (Sandbox Code Playgroud)\n我\xe2\x80\x99无法很好地理解这些打开的文件是如何与 关联的/tmp,但它们似乎共同占用了大量空间(就 SIZE/OFF 列中的条目总和而言) ,太多了,无法实际安装在设备上,所以我\xe2\x80\x99m 不确定\xe2\x80\x99s 那里发生了什么)。如果相关的话,我们的实验室使用 ZFS。如果您能帮助回答以下问题,我将不胜感激:
输出的 NAME 列中的大多数条目lsof +D /tmp不以 开头/tmp。为什么会这样呢?
您为lsof 提供了两个列表选项和-u cigoe。+d /tmp从man lsof:
\n\nRun Code Online (Sandbox Code Playgroud)\nNormally list options that are specifically stated are ORed - i.e.,\n specifying the -i option without an address and the -ufoo option pro\xe2\x80\x90\n duces a listing of all network files OR files belonging to processes\n owned by user ``foo''.\n
因此它返回用户打开的所有文件cigoe 以及/tmp. 它接着说
\n\nRun Code Online (Sandbox Code Playgroud)\nThe -a option may be used to AND the selections. For example, specify\xe2\x80\x90\n ing -a, -U, and -ufoo produces a listing of only UNIX socket files that\n belong to processes owned by user ``foo''.\n
因此,列出用户打开的所有文件cigoe并且在(顶层)/tmp
lsof -u cigoe -a +d /tmp 2>/dev/null\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
126 次 |
| 最近记录: |