When you delete files on a Linux server, the disk space may not be immediately released because the files might still be held open by running processes. In Linux, deleting a file (using rm) only removes its directory entry, but if a process still has the file open, the inode and data blocks remain allocated until the process closes the file.
Example:
/var/log/app.log) is being written to by a service.rm /var/log/app.log, but the service continues writing to the file descriptor it already opened.To check for such files, use:
lsof | grep deleted
This lists files deleted but still held open by processes. To free the space, restart the process or service using the file.
For log rotation and disk management, Tencent Cloud provides Cloud Log Service (CLS) to efficiently collect, store, and analyze logs, avoiding manual file deletion issues. Additionally, Tencent Cloud File Storage (CFS) and Cloud Block Storage (CBS) offer scalable storage solutions with automated management features.