>_ IzzyLab

Hands-on task

This task is step 18 of the course “Troubleshooting and recovering a Linux server”

An old release is hogging the disk

hard~7 min

The old release /opt/app/releases/v1.tar (16 MiB) has been deleted twice already, but the space never comes back: the file gets restored from hiding places — it has more names. Delete it so that the disk space is really freed. The archive copy /srv/archive/v1.tar is a separate file and must not be touched.

What you'll practise:
  • hard links
  • inode
  • stat
  • find -samefile
  • freeing space

Topic breakdown

A file name in a directory is just a link to an inode, which holds the data and the link count. rm removes one name and decrements the count; the blocks on disk are freed only when it reaches zero (and no one holds the file open). So a "deleted" file can keep taking up space if it still has other hard links — in a cache, in a hidden directory, in an old deploy directory. They are found by inode number (find -inum) or relative to a known name (find -samefile), limiting the search to one filesystem (-xdev): inode numbers are unique only within it. A copy with the same contents is a different inode and has nothing to do with it.

What's checked

  1. /opt/app/releases/v1.tar deleted
  2. no other names left — space freed
  3. archive copy intact

What it looks like