Last active
March 21, 2025 14:07
-
-
Save pekeq/9c5d415f8a5a41aca4117eeaad7ccde1 to your computer and use it in GitHub Desktop.
btrfs-balance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mount | grep ' type btrfs ' | awk -F' ' '{print $3}' | while read dir | |
do | |
# Run "btrfs balance" on mounted btrfs with following formula: | |
# https://github.com/netdata/netdata/issues/3203#issuecomment-356026930 | |
btrfs balance start -dusage=50 -dlimit=2 -musage=50 -mlimit=4 "${dir}" | |
# Trim unused blocks | |
fstrim --verbose "${dir}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment