>_ IzzyLab

Hands-on task

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

Clean up builds and the render cache

medium~5 min

The build server has run out of disk. Free up space selectively: in /srv/builds (with all subdirectories) delete files larger than 50 MB, and in /var/cache/render delete all temporary files with the .tmp extension at any depth. Everything else must stay.

What you'll practise:
  • find -size
  • find -name
  • du
  • selective deletion
  • free space

Topic breakdown

When the disk is full, it's tempting to delete "everything big", but the cleanup has to be targeted. find selects files by several conditions at once: -type f keeps only regular files, -size +50M means strictly larger than 50 mebibytes (the unit is rounded up, so a file slightly over 50M is selected too), -name matches the name against a pattern, which must be quoted. The -delete action removes matches without confirmation, so run the same command without it first and read the list. Reconnaissance before the cleanup is done with du sorted by size.

What's checked

  1. large files in /srv/builds deleted
  2. temporary .tmp files in the render cache deleted
  3. needed files preserved

What it looks like