Linux & servers

Why is my VPS disk still full after deleting files?

Short answer

A running process may still hold a deleted file open, or you may have freed space on a different filesystem. Check disk usage and inode usage separately before deleting more files.

What changes the answer

  • Deleted files still held open by a process
  • Free space on the affected filesystem
  • Available inodes for new files

Deleting a filename may not release its space yet

On Linux, removing a file's last directory entry does not immediately release its storage if a process still has the file open. The storage becomes available after the last open reference is closed.

A growing application log is a common example. You delete it, the directory looks smaller, but the application continues writing through its existing file handle. The space can remain occupied even though you cannot see the original filename.

Start with the filesystem that is actually full

Use df -h to check mounted filesystems and their available space. Match the full mount to the path where the application writes. Deleting files from a separate data volume will not free space on the root filesystem.

Use df -i as a separate check. A filesystem can run out of inodes after accumulating huge numbers of small files, even with storage capacity left. In that case, removing one large archive may not solve the problem.

Compare filesystem usage with directory usage. A large gap can justify investigating open deleted files, but it is a clue rather than proof: permissions, mount points and the scope of the directory scan also affect what you see.

Find the owner before restarting anything

An administrator can inspect open deleted files with a tool such as lsof, if installed. Identify the process and service involved. A supported log-reopen operation or planned service restart may release the file, but understand the effect on active requests first.

Avoid restarting every service or deleting unfamiliar system directories. If the culprit is a log, fix log rotation and retention after recovering space. Otherwise the same problem will return. For temporary files or queued jobs, find out why cleanup stopped before removing the backlog.