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

50 lines
5.9 KiB
Bash

#!/bin/bash
# READ-ONLY discovery of every place that holds data on a Felhom Proxmox host.
# Sizes, counts and dates only. No file contents. No command here can write.
export LC_ALL=C
N="nice -n 19 ionice -c3"
sec() { echo; echo "### $*"; }
sec "identity"; hostname; date -u +%FT%TZ; pveversion 2>/dev/null; felhom-agent --version 2>/dev/null
sec "in-flight (must be empty)"; pgrep -af 'vzdump|proxmox-backup-client|restic |apt-get|dpkg |pct restore|qmrestore' | grep -v pgrep
sec "lsblk"; lsblk -b -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,MODEL,TRAN
sec "df bytes"; df -B1 -T -x tmpfs -x devtmpfs -x overlay -x efivarfs
sec "df inodes"; df -i -x tmpfs -x devtmpfs -x overlay -x efivarfs
sec "vgs"; vgs --units b --nosuffix -o vg_name,vg_size,vg_free 2>/dev/null
sec "lvs"; lvs --units b --nosuffix -o lv_name,vg_name,lv_attr,lv_size,pool_lv,data_percent,metadata_percent,lv_metadata_size 2>/dev/null
sec "thin pool autoextend + monitoring"; lvmconfig activation/thin_pool_autoextend_threshold activation/thin_pool_autoextend_percent activation/monitoring 2>&1
sec "pvesm status"; pvesm status 2>&1
sec "storage.cfg (no secrets live here; passwords are in /etc/pve/priv)"; grep -v -i 'password\|keyring' /etc/pve/storage.cfg
sec "pvesm list per storage (count, bytes, oldest, newest)"
for s in $(pvesm status 2>/dev/null | awk 'NR>1 && $3=="active"{print $1}'); do
pvesm list "$s" 2>/dev/null | awk -v s="$s" 'NR>1{n++; b+=$4; split($1,a,"/"); k=$3; c[k]++; cb[k]+=$4} END{printf "%s total entries=%d bytes=%d\n", s, n, b; for(k in c) printf " %s type=%s entries=%d bytes=%d\n", s, k, c[k], cb[k]}'
done
sec "guest configs (disk + mountpoint lines only)"
for f in /etc/pve/lxc/*.conf /etc/pve/qemu-server/*.conf; do [ -f "$f" ] && { echo "-- $f"; grep -E '^(rootfs|mp[0-9]+|scsi[0-9]+|virtio[0-9]+|sata[0-9]+|efidisk|tpmstate|unused[0-9]+|memory|swap|\[)' "$f"; }; done
sec "vzdump.conf + jobs (keep rules)"; grep -v '^#' /etc/vzdump.conf 2>/dev/null; cat /etc/pve/jobs.cfg 2>/dev/null
sec "journald"; journalctl --disk-usage 2>&1; grep -rhv '^#' /etc/systemd/journald.conf /etc/systemd/journald.conf.d/ 2>/dev/null | grep -v '^$'; ls -la /var/log/journal/*/ 2>/dev/null | awk 'NR>1' | wc -l; journalctl --list-boots 2>/dev/null | sed -n '1p;$p'
sec "/var/log top"; $N du -x -B1 --max-depth=1 /var/log 2>/dev/null | sort -rn | head -25
sec "/var/log big files"; find /var/log -xdev -type f -size +5M -printf '%s\t%TY-%Tm-%Td\t%p\n' 2>/dev/null | sort -rn | head -30
sec "logrotate configs present"; ls /etc/logrotate.d/
sec "kernels installed"; dpkg-query -W -f='${Package}\t${Version}\t${Installed-Size}\t${db:Status-Abbrev}\n' 'proxmox-kernel-*' 'pve-kernel-*' 'linux-image-*' 2>/dev/null; uname -r
sec "proxmox-boot-tool"; proxmox-boot-tool kernel list 2>&1; proxmox-boot-tool status 2>&1 | head -20
sec "/boot"; df -B1 /boot /boot/efi 2>/dev/null; $N du -x -B1 --max-depth=1 /boot 2>/dev/null | sort -rn; ls -la /boot | awk '{print $5"\t"$6" "$7" "$8"\t"$9}' | sort -rn | head -30
sec "/lib/modules"; $N du -x -B1 --max-depth=1 /lib/modules 2>/dev/null | sort -rn
sec "apt"; $N du -x -B1 -s /var/cache/apt /var/lib/apt/lists /var/cache/apt/archives 2>/dev/null; ls /var/cache/apt/archives/*.deb 2>/dev/null | wc -l; apt-config dump 2>/dev/null | grep -i -E 'Periodic|Unattended|AutoRemove|Clean' | head -30; ls /etc/apt/apt.conf.d/
sec "apt autoremove candidates (dry read)"; apt-get -s autoremove 2>/dev/null | grep -c '^Remv'
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 | sed -n '1,5p;$p'; find /tmp /var/tmp -xdev -mindepth 1 -maxdepth 1 | wc -l
sec "systemd-tmpfiles rules touching tmp"; grep -rh -E '^\s*[dDqQ]\s+/(var/)?tmp' /usr/lib/tmpfiles.d /etc/tmpfiles.d 2>/dev/null
sec "/var/lib/vz"; $N du -x -B1 --max-depth=2 /var/lib/vz 2>/dev/null | sort -rn | head -20; for d in /var/lib/vz/dump /var/lib/vz/template/cache /var/lib/vz/template/iso; do echo "-- $d"; find "$d" -maxdepth 1 -type f -printf '%s\t%TY-%Tm-%Td\t%f\n' 2>/dev/null | sort -k2; done
sec "felhom dirs (candidates)"; ls -d /var/lib/felhom* /opt/felhom* /etc/felhom* /var/log/felhom* /usr/local/lib/felhom* /var/cache/felhom* /root/.felhom* /srv/felhom* /run/felhom* 2>/dev/null
for d in $(ls -d /var/lib/felhom* /opt/felhom* /etc/felhom* /var/log/felhom* /var/cache/felhom* /usr/local/lib/felhom* 2>/dev/null); do echo "-- $d"; $N du -x -B1 --max-depth=2 "$d" 2>/dev/null | sort -rn | head -25; echo " files=$(find "$d" -xdev -type f 2>/dev/null | wc -l) oldest=$(find "$d" -xdev -type f -printf '%TY-%Tm-%Td\n' 2>/dev/null | sort | head -1) newest=$(find "$d" -xdev -type f -printf '%TY-%Tm-%Td\n' 2>/dev/null | sort | tail -1)"; done
sec "felhom binaries + slots"; ls -la /usr/local/bin/ /usr/local/sbin/ 2>/dev/null | awk '{print $5"\t"$6" "$7" "$8"\t"$9" "$10" "$11}'
sec "root filesystem, top 70 dirs to depth 4"; $N du -x -B1 --max-depth=4 / 2>/dev/null | sort -rn | head -70
sec "root fs: file count per top dir"; for d in /var /usr /root /home /opt /etc /srv /tmp; do printf '%s\t%s\n' "$(find $d -xdev -type f 2>/dev/null | wc -l)" "$d"; done
sec "root home"; $N du -x -B1 --max-depth=1 /root 2>/dev/null | sort -rn | head -15
sec "other mounted filesystems, depth 2"
for m in $(df --output=target -x tmpfs -x devtmpfs -x overlay -x efivarfs | awk 'NR>1 && $1!="/" && $1!~/^\/boot/ && $1!~/^\/etc\/pve/'); do echo "-- $m"; $N du -x -B1 --max-depth=2 "$m" 2>/dev/null | sort -rn | head -40; done
sec "pve task logs + rrd"; $N du -x -B1 -s /var/log/pve /var/lib/rrdcached /var/lib/pve-cluster /var/lib/pve-manager 2>/dev/null; find /var/log/pve/tasks -type f 2>/dev/null | wc -l; find /var/log/pve/tasks -type f -printf '%TY-%Tm-%Td\n' 2>/dev/null | sort | sed -n '1p;$p'
sec "core dumps"; $N du -x -B1 -s /var/lib/systemd/coredump 2>/dev/null; ls /var/lib/systemd/coredump 2>/dev/null | wc -l
sec "swap"; swapon --show --bytes 2>/dev/null
sec "timers"; systemctl list-timers --all --no-pager 2>/dev/null | head -40
sec "end"; date -u +%FT%TZ