diff --git a/btrfs-send-receive.sh b/btrfs-send-receive.sh index b93e47d..2e21803 100755 --- a/btrfs-send-receive.sh +++ b/btrfs-send-receive.sh @@ -57,6 +57,9 @@ btrfs filesystem usage . duperemove -dr . > /dev/null btrfs subvolume sync . btrfs filesystem sync . +btrfs balance start --full-balance --enqueue . +btrfs subvolume sync . +btrfs filesystem sync . ## And to finish things off we shrink the filesystem to the minimum size. $OUTPUT_DIR/btrfs-shrink.py ## Sync changes to disk. diff --git a/btrfs-shrink.py b/btrfs-shrink.py index 6b4f32e..b8b8085 100755 --- a/btrfs-shrink.py +++ b/btrfs-shrink.py @@ -8,6 +8,11 @@ # portion but leave a bit of a buffer behind. Then we keep resizing until the # resize starts failing. +# TODO we can produce an even more squeezed image by deriving a complete partition +# from the initial partition. https://btrfs.readthedocs.io/en/latest/Seeding-device.html +# It essentially transfers the data from the seed device with nary a fragmentation. +# Requires juggling loop devices though, and the gains are in the sub 500MiB range. + import json import os import math