Operations 7 min read

Troubleshooting Disk Space Not Released After Deleting Files on Linux

This article explains why disk space may not be freed after deleting large log files on a Linux server, describes the underlying file system mechanisms, and provides a step‑by‑step troubleshooting guide using /tmp cleanup and the lsof command to identify and kill lingering processes.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Troubleshooting Disk Space Not Released After Deleting Files on Linux

One business system's server monitoring alert indicated that disk usage had reached 50%; after manually deleting large log files, the space seemed partially freed, but a subsequent alert revealed that the space was not fully released.

Problem reproduction and solution:

1. Disk space usage shows 504 GB total, with 298 GB actually used.

Linux deletion strategy: Linux has no recycle bin, so deleted files are moved to the /tmp directory and periodically cleared.

Many servers are installed without a separate /tmp partition, so /tmp can consume a large amount of space; clearing /tmp can immediately free space.

2. Solution approach

Normally, deleted files free space, but exceptions occur when a file is locked by a process or continuously written to; understanding this requires knowledge of Linux file storage mechanisms.

A file consists of data and pointer parts; the pointer resides in the file system's metadata. Deleting data removes the pointer from metadata, allowing the space to be overwritten. If a process locks the file, the pointer remains, so the kernel treats the file as still existing, and df shows the space as used.

3. Problem investigation

To check if a process is still holding the deleted file, use the Linux lsof command to list open deleted files:

lsof | grep delete

Identify large files, kill the associated process with kill -9 <pid> , and the space will be released.

----------------------end---------------------

Recommended reading

1 实战-k8s监控MySQL

2 实战-Prometheus监控域名证书时间

3 实战-Prometheus监控Mysql

4 实战-Prometheus监控Mysql

5 实战-Prometheus监控Redis

6 Nginx通过Lua+Redis实现WAF动态封禁IP

7 运维必备的MySQL+Python运维实战课程

8 运维不会Python Web就落伍了!

9 Kubernetes持久化实战 K8S集群部署+Jenkins自动化构建

10 企业级Redis入门到精通 Redis基础+进阶+实战应用+项目实战

If this article helped you, please like, watch, and share—it greatly supports my continued sharing of quality content. Thank you 🙏🏻, feel free to DM for learning materials!

点赞→ 分享 → 在看

operationsLinuxTroubleshootingDisk Spacelsoffile deletion
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.