Linux 文件删除后未释放空间解决办法
Linux lsof 大约 2298 字现象
文件删除后,磁盘空间未释放。
排查
使用lsof
命令查看哪些文件已经被删除,而系统扔持有该文件的句柄未释放(其他进程中正在使用该文件)。
lsof | grep deleted
输出
java 89018 root 125w REG 0,22 /logs/log-info.log (deleted)
查看进程为89018
的125
号文件描述符,还保留着原始文件的内容,清空之。
> /proc/89018/fd/125
备注
对于deleted
文件句柄的释放,目前已知的解决方案是重启应用。
lsof字段含义
使用man lsof
查看更多字段。
FD is the File Descriptor number of the file or:
cwd current working directory;
Lnn library references (AIX);
err FD information error (see NAME column);
jld jail directory (FreeBSD);
ltx shared library text (code and data);
Mxx hex memory-mapped type number xx.
m86 DOS Merge mapped file;
mem memory-mapped file;
mmap memory-mapped device;
pd parent directory;
rtd root directory;
tr kernel trace file (OpenBSD);
txt program text (code and data);
v86 VP/ix mapped file;
FD is followed by one of these characters, describing the mode under which the file is open:
r for read access;
w for write access;
u for read and write access;
space if mode unknown and no lock
character follows;
‘-’ if mode unknown and lock
character follows.
The mode character is followed by one of these lock characters, describing the type of lock applied to the file:
N for a Solaris NFS lock of unknown type;
r for read lock on part of the file;
R for a read lock on the entire file;
w for a write lock on part of the file;
W for a write lock on the entire file;
u for a read and write lock of any length;
U for a lock of unknown type;
x for an SCO OpenServer Xenix lock on part of the file;
X for an SCO OpenServer Xenix lock on the entire file;
space if there is no lock.
See the LOCKS section for more information on the lock information character.
The FD column contents constitutes a single field for parsing in post-processing scripts.
阅读 2317 · 发布于 2020-12-29
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
软考-系统架构设计师:性能评价方法阅读 3386
-
Spring Boot 获取 HttpServletRequest 的几种方式阅读 1542
-
VisualVM 监控注册成 Windows 服务的 Tomcat 之 jstatd 方式一阅读 1981
-
Linux 下编译安装 PHP 时报 libxml2 configure: error阅读 2066
-
走进 Rust:打印结构体字段阅读 6774
-
Java G1 垃圾回收器阅读 1471
-
OpenLDAP 简介阅读 478
-
MySQL 之 where 和 having 的区别阅读 1705
-
MySQL Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root阅读 5386
-
Java 环境变量 JDK_JAVA_OPTIONS 与 JAVA_TOOL_OPTIONS 差别阅读 826