move extend LVM to the top

Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
This commit is contained in:
Daniel Hansson 2023-08-10 15:54:52 +02:00 committed by GitHub
parent f791c536a3
commit 9b605630b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,38 @@ fi
# Restart mode: (l)ist only, (i)nteractive or (a)utomatically.
sed -i "s|#\$nrconf{restart} = .*|\$nrconf{restart} = 'a';|g" /etc/needrestart/needrestart.conf
# Fix LVM on BASE image
if grep -q "LVM" /etc/fstab
then
if [ -n "$PROVISIONING" ] || yesno_box_yes "Do you want to make all free space available to your root partition?"
then
# Resize LVM (live installer is &%¤%/!
# VM
print_text_in_color "$ICyan" "Extending LVM, this may take a long time..."
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Run it again manually just to be sure it's done
while :
do
lvdisplay | grep "Size" | awk '{print $3}'
if ! lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +100M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
resize2fs /dev/ubuntu-vg/ubuntu-lv
break
fi
fi
fi
fi
done
fi
fi
# Install needed dependencies
install_if_not lshw
install_if_not net-tools
@ -156,38 +188,6 @@ else
sleep 3
fi
# Fix LVM on BASE image
if grep -q "LVM" /etc/fstab
then
if [ -n "$PROVISIONING" ] || yesno_box_yes "Do you want to make all free space available to your root partition?"
then
# Resize LVM (live installer is &%¤%/!
# VM
print_text_in_color "$ICyan" "Extending LVM, this may take a long time..."
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Run it again manually just to be sure it's done
while :
do
lvdisplay | grep "Size" | awk '{print $3}'
if ! lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +100M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
resize2fs /dev/ubuntu-vg/ubuntu-lv
break
fi
fi
fi
fi
done
fi
fi
# Check if it's a clean server
stop_if_installed postgresql
stop_if_installed apache2