Files
felhom.eu/documentation/audits/space-list-2026-11-10/tools/host-baseline.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

41 lines
3.8 KiB
Bash

#!/bin/bash
# Space list 2026-11-10 — host baseline. READ-ONLY by construction: df, du, ls, lvs, find -printf, journalctl --disk-usage.
# Sizes are ALLOCATED bytes (du -B1), not apparent size.
# Output: place <TAB> bytes <TAB> entries <TAB> UTC time. Run as root on a Proxmox host.
set -u
T() { date -u +%Y-%m-%dT%H:%M:%SZ; }
row() { printf '%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$(T)"; }
dub() { [ -e "$1" ] && nice -n 19 ionice -c3 du -sx -B1 "$1" 2>/dev/null | cut -f1 || echo NA; }
cnt() { [ -d "$1" ] && find "$1" -xdev -maxdepth "${3:-1}" -mindepth 1 ${2:+-name "$2"} 2>/dev/null | wc -l || echo NA; }
# refuse to walk while a backup / restore / update is in flight
if pgrep -x vzdump >/dev/null || pgrep -x apt-get >/dev/null || pgrep -x dpkg >/dev/null || pgrep -f 'pct restore' >/dev/null; then
row "IN-FLIGHT-skip-walk" NA NA; exit 3; fi
row "host:rootfs-used" "$(df -B1 --output=used / | tail -1 | tr -d ' ')" "size=$(df -B1 --output=size / | tail -1 | tr -d ' ')"
lvs --noheadings --units b --nosuffix -o lv_name,lv_size,data_percent,metadata_percent,lv_attr pve 2>/dev/null | awk '$5 ~ /^t/ {printf "%s %s %s %s\n",$1,$2,$3,$4}' | while read n s d m; do
row "host:thinpool-$n-data" "$(awk -v s="$s" -v d="$d" 'BEGIN{printf "%.0f", s*d/100}')" "size=$s pct=$d"
row "host:thinpool-$n-metadata-pct" "NA" "pct=$m"
done
for d in $(awk '/^dir:/{f=1;next} /^[a-z]+:/{f=0} f&&$1=="path"{print $2}' /etc/pve/storage.cfg 2>/dev/null); do
row "host:dump:$d/dump" "$(dub "$d/dump")" "archives=$(cnt "$d/dump" 'vzdump-*.tar.zst') logs=$(cnt "$d/dump" '*.log') all=$(cnt "$d/dump")"
row "host:template-cache:$d/template" "$(dub "$d/template")" "$(cnt "$d/template" '' 2)"
done
row "host:journal:/var/log/journal" "$(dub /var/log/journal)" "files=$(find /var/log/journal -type f 2>/dev/null | wc -l)"
row "host:var-log-other" "$(nice -n 19 ionice -c3 du -sx -B1 --exclude=/var/log/journal /var/log 2>/dev/null | cut -f1)" "pve-tasks=$(find /var/log/pve/tasks -type f 2>/dev/null | wc -l)"
row "host:rrdcached:/var/lib/rrdcached" "$(dub /var/lib/rrdcached)" "NA"
row "host:kernels:/lib/modules" "$(dub /lib/modules)" "kernels=$(ls /lib/modules 2>/dev/null | wc -l)"
row "host:boot:/boot" "$(nice du -sx -B1 /boot 2>/dev/null | cut -f1)" "initrd=$(ls /boot/initrd.img-* 2>/dev/null | wc -l)"
mountpoint -q /boot/efi && row "host:esp:/boot/efi" "$(df -B1 --output=used /boot/efi | tail -1 | tr -d ' ')" "size=$(df -B1 --output=size /boot/efi | tail -1 | tr -d ' ')"
row "host:apt-cache:/var/cache/apt" "$(dub /var/cache/apt)" "debs=$(cnt /var/cache/apt/archives '*.deb')"
row "host:apt-lists:/var/lib/apt/lists" "$(dub /var/lib/apt/lists)" "NA"
row "host:agent-state:/var/lib/felhom-agent" "$(dub /var/lib/felhom-agent)" "$(cnt /var/lib/felhom-agent)"
row "host:agent-selfupdate:/var/lib/felhom-agent/selfupdate" "$(dub /var/lib/felhom-agent/selfupdate)" "binaries=$(cnt /var/lib/felhom-agent/selfupdate 'felhom-agent-*')"
row "host:agent-bak:/usr/local/bin/felhom-agent.bak-*" "$(find /usr/local/bin -maxdepth 1 -name 'felhom-agent.bak-*' -printf '%s\n' 2>/dev/null | awk '{s+=$1} END{print s+0}')" "$(cnt /usr/local/bin 'felhom-agent.bak-*')"
row "host:os-apply:/var/lib/felhom-os-apply" "$(dub /var/lib/felhom-os-apply)" "bundle-prev=$(cnt /var/lib/felhom-os-apply/bundle-prev)"
row "host:tmp:/tmp" "$(dub /tmp)" "$(cnt /tmp)"
row "host:var-tmp:/var/tmp" "$(dub /var/tmp)" "$(cnt /var/tmp)"
row "host:root-home:/root" "$(dub /root)" "NA"
row "host:swap-used" "$(awk 'NR>1{s+=$4} END{print s*1024}' /proc/swaps)" "size=$(awk 'NR>1{s+=$3} END{print s*1024}' /proc/swaps)"
row "host:journal-lines-last-hour" "NA" "all=$(journalctl --since '-1h' -q --no-pager -o cat 2>/dev/null | wc -l) sudo=$(journalctl --since '-1h' -q --no-pager -t sudo -o cat 2>/dev/null | wc -l)"
row "host:journal-oldest-entry" "NA" "$(journalctl -q --no-pager -o short-iso 2>/dev/null | head -1 | awk '{print $1}')"
exit 0