>_ IzzyLab

Hands-on task

This task is step 19 of the course “Disks, links and free space”

Delete a file so the space is actually freed

hard~7 min

The server is running out of space. The file /srv/data/big.bin (20 MiB) is no longer needed — delete it so that disk space is actually freed. Note that /var/backups/big.bin is a separate backup copy and must not be touched.

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

Topic breakdown

A hard link is another name for the same inode: all names share the data and metadata, and the inode keeps a link count. rm removes only one name and decrements the count; the blocks are freed when the count reaches zero (and nobody has the file open). So "I deleted it but the space didn't come back" often means the file still has other names — in a cache, an old release, a hidden directory. You find them by inode number (find -inum) or relative to a known name (find -samefile), limiting the search to one filesystem, since inode numbers are unique only within it. A copy with the same contents is a separate file with its own inode and has nothing to do with the deletion.

What's checked

  1. /srv/data/big.bin deleted
  2. the file has no other names left — space is freed
  3. the backup /var/backups/big.bin is intact

What it looks like