Skip to content

Instantly share code, notes, and snippets.

@c-goes
Last active May 12, 2021 20:32
Show Gist options
  • Save c-goes/fe17b71ad1f114e7bc38f8aff67064ef to your computer and use it in GitHub Desktop.
Save c-goes/fe17b71ad1f114e7bc38f8aff67064ef to your computer and use it in GitHub Desktop.
zsysctl cleanup script -- release space on bpool on Ubuntu 20.04 root on zfs install
#!/usr/bin/env bash
set -euxo pipefail
# use at your own risk
zfs list -r -t snapshot -o name,used,referenced,creation bpool/BOOT | python -c "import sys;print('\n'.join([y[0].split('autozsys_')[1] for y in [x.split() for x in sys.stdin.readlines()] if y[0] != 'NAME']))" | xargs -i"{}" -n1 sudo zsysctl state remove {} --system
sudo zsysctl service gc --all -vv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment