Wanna See What Your Drives are Being Used for by Linux
Jump to navigation
Jump to search
Ever had occasion, like in 2026 where drives are expensive, to see what things are being used for, so maybe stuff can be combined into a single drive?
Well, how 'ya gonna tell what needs to be reconfigured?
Below is a basic way to scan 'dependencies' for any Services / Daemons / Programs that use said drive(s);
MOUNT=''
DEV=''
UUID=''
PARTUUID=''
LABEL=''
MODEL=''
SERIAL=''
WWN=''
PATFILE="$(mktemp)"
printf '%s\n' "$MOUNT" "$DEV" "$UUID" "$PARTUUID" "$LABEL" "$MODEL" "$SERIAL" "$WWN" | sed '/^$/d' > "$PATFILE"
find /etc /usr/local /opt /srv /root /home /var/spool/cron -type f -print0 2>/dev/null | xargs -0 -r grep -IlF -f "$PATFILE" 2>/dev/null
rm -f "$PATFILE"