pvsqueeze.sh update

This commit is contained in:
Chris Hammer 2025-03-20 15:26:02 -04:00
parent a4a9c2fa89
commit 212ace2d6d

View File

@ -1,10 +1,14 @@
#!/bin/bash #!/bin/bash
# #
# pvsqueeze - Squeeze PEs into free holes # pvsqueeze - Squeeze linear extents into free holes
# #
# This script iteratively moves linear (allocated to LV) PEs to fill in free # This script iteratively moves linear (allocated to LV) extents to fill in
# holes found in a PV segement map. The end result is that all free PEs are # free holes found in a PV segment map. The end result is that all free
# at the end of the PV. Use this script as required in anger! # extents are at the end of the PV. Use this script in anger as required!
#
# The script outputs the PV segment map before moving anything, then iterates
# stuffing extents in each free hole until there are no more except for the
# last one, and finally outputs the PV segment map again showing the changes.
# #
# Usage # Usage
@ -51,6 +55,7 @@ while true; do
[[ $free_start -gt $move_start ]] && break [[ $free_start -gt $move_start ]] && break
# Move last linear PEs to the free segment # Move last linear PEs to the free segment
[[ $free_size -gt $move_size ]] && free_size=$move_size
from_range="$pvdev:$((move_start+move_size-free_size))-$((move_start+move_size-1))" from_range="$pvdev:$((move_start+move_size-free_size))-$((move_start+move_size-1))"
to_range="$pvdev:$((free_start))-$((free_start+free_size))" to_range="$pvdev:$((free_start))-$((free_start+free_size))"
echo "Moving $from_range to $to_range..." echo "Moving $from_range to $to_range..."