Merge pull request #158 from saveriomiroddi/make_temp_partition_space_recovery_conditional
If the tail space is larger than the required temporary partition, don't recover it
This commit is contained in:
commit
50d3fbf2ee
@ -590,9 +590,17 @@ function ask_free_tail_space {
|
|||||||
v_free_tail_space=$ZFS_FREE_TAIL_SPACE
|
v_free_tail_space=$ZFS_FREE_TAIL_SPACE
|
||||||
else
|
else
|
||||||
local tail_space_invalid_message=
|
local tail_space_invalid_message=
|
||||||
|
local tail_space_message="${tail_space_invalid_message}Enter the space in GiB to leave at the end of each disk (0 for none).
|
||||||
|
|
||||||
|
If the tail space is less than the space required for the temporary O/S installation, it will be reclaimed after it.
|
||||||
|
|
||||||
|
WATCH OUT! In rare cases, the reclamation may cause an error; if this happens, set the tail space to ${c_temporary_volume_size} gigabytes. It's still possible to reclaim the space after the ZFS installation is over.
|
||||||
|
|
||||||
|
For detailed informations, see the wiki page: https://github.com/saveriomiroddi/zfs-installer/wiki/Tail-space-reclamation-issue.
|
||||||
|
"
|
||||||
|
|
||||||
while [[ ! $v_free_tail_space =~ ^[0-9]+$ ]]; do
|
while [[ ! $v_free_tail_space =~ ^[0-9]+$ ]]; do
|
||||||
v_free_tail_space=$(whiptail --inputbox "${tail_space_invalid_message}Enter the space in GiB to leave at the end of each disk (0 for none):" 30 100 0 3>&1 1>&2 2>&3)
|
v_free_tail_space=$(whiptail --inputbox "$tail_space_message" 30 100 0 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
tail_space_invalid_message="Invalid size! "
|
tail_space_invalid_message="Invalid size! "
|
||||||
done
|
done
|
||||||
@ -756,13 +764,7 @@ function install_host_packages_UbuntuServer {
|
|||||||
function setup_partitions {
|
function setup_partitions {
|
||||||
print_step_info_header
|
print_step_info_header
|
||||||
|
|
||||||
local root_partition_start=-$((c_temporary_volume_size + v_free_tail_space))G
|
local required_tail_space=$((v_free_tail_space > c_temporary_volume_size ? v_free_tail_space : c_temporary_volume_size))
|
||||||
|
|
||||||
if [[ $v_free_tail_space -eq 0 ]]; then
|
|
||||||
local tail_space_start=0
|
|
||||||
else
|
|
||||||
local tail_space_start="-${v_free_tail_space}G"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for selected_disk in "${v_selected_disks[@]}"; do
|
for selected_disk in "${v_selected_disks[@]}"; do
|
||||||
# wipefs doesn't fully wipe ZFS labels.
|
# wipefs doesn't fully wipe ZFS labels.
|
||||||
@ -777,8 +779,8 @@ function setup_partitions {
|
|||||||
|
|
||||||
sgdisk -n1:1M:+"${c_efi_system_partition_size}M" -t1:EF00 "$selected_disk" # EFI boot
|
sgdisk -n1:1M:+"${c_efi_system_partition_size}M" -t1:EF00 "$selected_disk" # EFI boot
|
||||||
sgdisk -n2:0:+"$v_boot_partition_size" -t2:BF01 "$selected_disk" # Boot pool
|
sgdisk -n2:0:+"$v_boot_partition_size" -t2:BF01 "$selected_disk" # Boot pool
|
||||||
sgdisk -n3:0:"$root_partition_start" -t3:BF01 "$selected_disk" # Root pool
|
sgdisk -n3:0:"-${required_tail_space}G" -t3:BF01 "$selected_disk" # Root pool
|
||||||
sgdisk -n4:0:"$tail_space_start" -t4:8300 "$selected_disk" # Temporary partition
|
sgdisk -n4:0:0 -t4:8300 "$selected_disk" # Temporary partition
|
||||||
done
|
done
|
||||||
|
|
||||||
# The partition symlinks are not immediately created, so we wait.
|
# The partition symlinks are not immediately created, so we wait.
|
||||||
@ -1064,6 +1066,7 @@ function sync_os_temp_installation_dir_to_rpool {
|
|||||||
function remove_temp_partition_and_expand_rpool {
|
function remove_temp_partition_and_expand_rpool {
|
||||||
print_step_info_header
|
print_step_info_header
|
||||||
|
|
||||||
|
if (( v_free_tail_space < c_temporary_volume_size )); then
|
||||||
if [[ $v_free_tail_space -eq 0 ]]; then
|
if [[ $v_free_tail_space -eq 0 ]]; then
|
||||||
local resize_reference=100%
|
local resize_reference=100%
|
||||||
else
|
else
|
||||||
@ -1085,6 +1088,11 @@ function remove_temp_partition_and_expand_rpool {
|
|||||||
for selected_disk in "${v_selected_disks[@]}"; do
|
for selected_disk in "${v_selected_disks[@]}"; do
|
||||||
zpool online -e "$v_rpool_name" "$selected_disk-part3"
|
zpool online -e "$v_rpool_name" "$selected_disk-part3"
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
for selected_disk in "${v_selected_disks[@]}"; do
|
||||||
|
wipefs --all "$selected_disk-part4"
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_jail {
|
function prepare_jail {
|
||||||
|
Loading…
Reference in New Issue
Block a user