Hunt orphans in your own environment

short · 40 min · Objective 3.1

Task

Find the resources nothing is using. Do it on your own machine's container and volume estate if you have no cloud account -- the categories and the search technique are identical, and the habit is what transfers.

Steps

  1. Enumerate everything: containers running and stopped, images, volumes, networks, and VM disk files. Write the inventory to lab/inventory.txt.
  2. Identify the orphans by category: volumes attached to nothing, images no container references, networks with no members, disk files with no VM. Record each with its size in lab/orphans.csv.
  3. Total the reclaimable space and express it as a percentage of the whole.
  4. For each orphan, write the QUERY that found it -- the specific state to filter on -- rather than 'I looked'. These queries are the reusable part.
  5. Apply the safe sequence to one orphan: isolate it first (stop, disconnect or rename), wait, confirm nothing broke, then remove it. Record the sequence you followed.

Verify

awk -F, 'NR>1 && NF>=2 {n++} END {print n" orphan(s) found"}' lab/orphans.csv
grep -Eci 'volume|disk' lab/orphans.csv
grep -Eci 'isolat|stop|wait' lab/orphans.csv
grep -c '^' lab/inventory.txt

At least three orphans, and the isolate-then-delete sequence recorded. Deleting straight away is the habit this lab exists to replace.

This is an independent study companion for CompTIA Cloud+ CV0-004 and is not produced by or endorsed by CompTIA.