Skip to content

Instantly share code, notes, and snippets.

@dominicusin
Last active April 14, 2020 20:57
Show Gist options
  • Save dominicusin/d893d3dea0fac20a7175237ad38fcb96 to your computer and use it in GitHub Desktop.
Save dominicusin/d893d3dea0fac20a7175237ad38fcb96 to your computer and use it in GitHub Desktop.
nixos
#!/bin/sh --verbose
nix-collect-garbage -d
nix-store --gc
nix-store --verify --check-contents --repair
nix-store --optimise
chattr -R +c /
btrfs device scan --all-devices
for filesystem in $(mount -t btrfs | awk '{print $3}' )
do
mount -o remount,clear_cache,compress=zlib,rw $filesystem
btrfs property set $filesystem compression zlib
btrfs filesystem resize max $filesystem
btrfs filesystem sync $filesystem
done
btrfs scrub start -BdRf /
btrfs fi def -czlib -v -r -f /
btrfs balance start -v -f --full-balance -dconvert=single,usage=99 -mconvert=single,usage=99 -sconvert=single,usage=99 /
bedup dedup
fdupes -r -S / | duperemove --fdupes
duperemove -drh /*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment