{
  "id": 14987606,
  "title": "Why a Deleted Linux File Can Still Consume Disk Space",
  "url": "https://urgent.news/2026/10/16/why-a-deleted-linux-file-can-still-consume-disk-space",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-16T16:05:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/asepsayyad007/why-a-deleted-linux-file-can-still-consume-disk-space-4mlk"
  },
  "original_language": "en",
  "account": "When a 50GB log file named debug.log was removed from the root partition, the partition still reported 100% capacity with no free space. This seemed perplexing. To understand what was happening, it's essential to know how Linux handles file deletion and inode management.\n\nLinux does not delete files when you use the rm command. Instead, the rm command removes the directory entry that points to the file. It calls the unlink() system call, which decrements the inode's link count (i_nlink). When the i_nlink count reaches zero, indicating no directory entries are referencing the inode, the file is considered unlinked. However, the data blocks allocated for the file are not immediately reclaimed.\n\nIn Linux, files are composed of data blocks and inodes. The inode contains metadata like ownership, permissions, file size, and pointers to data blocks. The data blocks store the actual file contents. When a file is unlinked, the directory entry is removed, but the inode and its associated data blocks remain allocated until all processes referencing the file close their file descriptors.\n\nIf a process had opened the debug.log file, it would still hold an active file descriptor pointing to the inode. The i_nlink count would be zero, but the inode and data blocks would be marked as active in the kernel's open file table. This process could continue writing to those blocks, making them appear as if they are still in use.\n\nThe confusion arises from the two different ways Linux reports disk usage: df and du. df checks the superblock and reports the total number of blocks allocated to a filesystem, including those still allocated even if no files are pointing to them. On the other hand, du traverses directories and calculates the space used by files and directories based on their inode and block allocations.\n\nSo, in this case, the 52GB debug.log file had not been completely deleted from the filesystem. Its data blocks remained allocated, and its inode had an i_nlink count of zero but was still referenced by an active process. Until that process closed its file descriptor, the disk space would remain reserved, causing the partition to appear full.",
  "summary": "Your root partition is at 100%, you ran rm on a 50GB log file, and df still reports zero free bytes. Here is how inodes, unlinked file descriptors, and kernel references keep ghost data alive, and how to recover disk space without restarting production. A critical disk alert fires on your phone. A busy database node or API host just crossed 99% disk capacity on /var . Applications begin failing.…",
  "key_points": [
    "Deleting a file in Linux removes directory entry, not file data",
    "Inode remains allocated until all processes close file descriptors",
    "df reports total allocated blocks, du shows actual file space used"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}