Files
felhom.eu/documentation/audits/space-list-2026-11-10/tools/guest-discover.sh
T
admin 47e372a5f4
gates / gates (push) Successful in 1m58s
Space list (pilot of the gap review): 45 places, eight questions each
Read-only measurement on demo-hp, demo-felhom and Tester 1, two readings.
Audit folder documentation/audits/space-list-2026-11-10/ (README, TABLE,
MATRIX, evidence, tools). 360 answers: A 294, D 0, K 19, N 47.

Register 225 -> 230: R-1368 (host places that only grow: kernels, agent
binaries), R-1369 (no written way out of a full disk), R-1370 (no space
budget for the host disk), R-1371 (no space alarm; host-disk mail goes to
the household), R-1372 (small guest places). A dated line on nine existing
rows. Section headings set to the real counts; R-1268 and R-1312 moved to
their category's section.

STATUS: new Updated paragraph, decisions D67-D70. N100 diary line.
Two stale facts corrected in 05-hub-architecture.md and 11-os-updates.md.
Nothing was changed on any machine.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-11-10 10:50:44 +01:00

40 lines
4.2 KiB
Bash

#!/bin/bash
# READ-ONLY discovery of every place that holds data inside a Felhom guest (LXC).
# Sizes, counts and dates only. No file contents of app or household data. Never dumps Env.
export LC_ALL=C
N="nice -n 19 ionice -c3"
sec() { echo; echo "### $*"; }
sec "identity"; hostname; date -u +%FT%TZ; grep PRETTY /etc/os-release; cat /etc/felhom-scratch-disposition 2>/dev/null | head -3
sec "df bytes"; df -B1 -T -x tmpfs -x devtmpfs -x overlay -x efivarfs 2>/dev/null
sec "df inodes"; df -i -x tmpfs -x devtmpfs -x overlay -x efivarfs 2>/dev/null
sec "docker info"; docker info --format 'driver={{.Driver}} root={{.DockerRootDir}} logdriver={{.LoggingDriver}} images={{.Images}} containers={{.Containers}} running={{.ContainersRunning}} server={{.ServerVersion}}'
sec "daemon.json"; cat /etc/docker/daemon.json 2>/dev/null; ls -la --time-style=long-iso /etc/docker/ 2>/dev/null
sec "docker system df"; docker system df 2>&1
sec "containers (name image state logdriver logopts)"
for c in $(docker ps -aq); do docker inspect --format '{{.Name}} {{.Config.Image}} {{.State.Status}} {{.HostConfig.LogConfig.Type}} {{json .HostConfig.LogConfig.Config}} restart={{.RestartCount}} created={{.Created}}' "$c"; done | sort
sec "container log files (bytes path) and total"
R=$(docker info --format '{{.DockerRootDir}}')
find "$R/containers" -maxdepth 2 -type f -name '*.log*' -printf '%s\t%TY-%Tm-%Td\t%p\n' 2>/dev/null | sort -rn | head -60
find "$R/containers" -maxdepth 2 -type f -name '*.log*' -printf '%s\n' 2>/dev/null | awk '{s+=$1;n++} END{print "TOTAL bytes="s" files="n}'
sec "container writable layers (docker ps -as)"; docker ps -as --format '{{.Names}} {{.Size}}' | sort
sec "images"; docker images -a --format '{{.Repository}}:{{.Tag}} {{.ID}} {{.CreatedAt}} {{.Size}}' | sort
sec "images count / dangling"; docker images -q | sort -u | wc -l; docker images -f dangling=true -q | wc -l
sec "images in use by a container"; docker ps -a --format '{{.Image}}' | sort | uniq -c
sec "volumes (count, anonymous count, dangling count)"; docker volume ls -q | wc -l; docker volume ls -q | grep -cE '^[0-9a-f]{64}$'; docker volume ls -f dangling=true -q | wc -l
sec "volumes by size (system df -v, Local Volumes block)"; docker system df -v 2>/dev/null | awk '/^Local Volumes/{p=1} /^Build cache/{p=0} p' | head -150
sec "build cache"; docker system df -v 2>/dev/null | awk '/^Build cache/{p=1} p' | head -8
sec "docker root du depth 1"; $N du -x -B1 --max-depth=1 "$R" 2>/dev/null | sort -rn
sec "journald"; journalctl --disk-usage 2>&1; grep -rhv '^#' /etc/systemd/journald.conf /etc/systemd/journald.conf.d/ 2>/dev/null | grep -v '^$'; journalctl -u systemd-journald --no-pager 2>/dev/null | grep -i 'max\|vacuum\|deleted' | tail -4
sec "/var/log"; $N du -x -B1 --max-depth=1 /var/log 2>/dev/null | sort -rn | head -15; find /var/log -xdev -type f -size +5M -printf '%s\t%TY-%Tm-%Td\t%p\n' 2>/dev/null | sort -rn | head
sec "apt"; $N du -x -B1 -s /var/cache/apt /var/lib/apt/lists 2>/dev/null; ls /var/cache/apt/archives/*.deb 2>/dev/null | wc -l
sec "tmp"; $N du -x -B1 -s /tmp /var/tmp 2>/dev/null; find /tmp /var/tmp -xdev -mindepth 1 -maxdepth 1 -printf '%TY-%Tm-%Td\t%s\t%p\n' 2>/dev/null | sort | head -40; echo "entries=$(find /tmp /var/tmp -xdev -mindepth 1 -maxdepth 1 | wc -l)"
sec "felhom dirs"; ls -d /var/lib/felhom* /opt/felhom* /opt/docker /etc/felhom* /var/log/felhom* /var/cache/felhom* /srv/* 2>/dev/null
sec "root filesystem top 45 to depth 4"; $N du -x -B1 --max-depth=4 / 2>/dev/null | sort -rn | head -45
sec "/var/lib/felhom depth 3 (data volume)"; $N du -x -B1 --max-depth=3 /var/lib/felhom 2>/dev/null | sort -rn | grep -v "/docker/overlay2/\|/docker/volumes/\|/docker/containers/\|/docker/image/\|/docker/buildkit/" | head -70
sec "/opt/docker depth 2"; $N du -x -B1 --max-depth=2 /opt/docker 2>/dev/null | sort -rn | head -50
sec "drives under /mnt/felhom-drives (depth 3 from each drive)"
for d in /mnt/felhom-drives/*; do [ -d "$d" ] && { echo "-- $d"; df -B1 "$d" | tail -1; $N du -x -B1 --max-depth=3 "$d" 2>/dev/null | sort -rn | head -60; }; done
sec "timers"; systemctl list-timers --all --no-pager 2>/dev/null | head -20
sec "cron"; ls /etc/cron.d /etc/cron.daily /etc/cron.weekly 2>/dev/null
sec "end"; date -u +%FT%TZ