removing bugs from lvm

This commit is contained in:
mfgbhatti 2022-02-13 13:49:04 +00:00
parent 405bffefd3
commit c5c50b8d1d
2 changed files with 8 additions and 4 deletions

View File

@ -84,7 +84,7 @@ do_format() {
do_lvm() { do_lvm() {
i=0 i=0
while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do
if [[ "$i" -eq "${#LVM_PART_NUM[@]}" ]]; then if [[ "${#LVM_PART_NUM[@]}" -eq 1 ]]; then
lvcreate --extents 100%FREE "$LVM_VG" --name "${LVM_NAMES[$i]}" lvcreate --extents 100%FREE "$LVM_VG" --name "${LVM_NAMES[$i]}"
else else
lvcreate --size "${LVM_SIZES[$i]}" "$LVM_VG" --name "${LVM_NAMES[$i]}" lvcreate --size "${LVM_SIZES[$i]}" "$LVM_VG" --name "${LVM_NAMES[$i]}"

View File

@ -98,16 +98,20 @@ set_lvm() {
echo "And will be mounted at /mnt/ and other partitions will be mounted" echo "And will be mounted at /mnt/ and other partitions will be mounted"
echo "at /mnt/partition_name by making a directory /mnt/partition_name" echo "at /mnt/partition_name by making a directory /mnt/partition_name"
i=1 i=0
_LVM_NAMES=() _LVM_NAMES=()
LVM_SIZES=() LVM_SIZES=()
if [[ -z "$_PART_NUM" ]]; then if [[ -z "$_PART_NUM" || "$_PART_NUM" -eq 1 ]]; then
_PART_NUM=1 _PART_NUM=1
_LVM_NAMES+=("root") _LVM_NAMES+=("root")
LVM_SIZES+=("100%FREE") # LVM_SIZES+=("100%FREE")
i=2 i=2
fi fi
while [[ $i -le "$_PART_NUM" ]]; do while [[ $i -le "$_PART_NUM" ]]; do
if [[ "$_PART_NUM" -eq 1 ]]; then
read -r -p "Enter last partition name [like home]: " _LVM_NAME
_LVM_NAMES+=("$_LVM_NAME")
fi
read -r -p "Enter $i partition name [like root]: " _LVM_NAME read -r -p "Enter $i partition name [like root]: " _LVM_NAME
_LVM_NAMES+=("$_LVM_NAME") _LVM_NAMES+=("$_LVM_NAME")
read -r -p "Enter $i partition size [like 25G, 200M]: " _LVM_SIZE read -r -p "Enter $i partition size [like 25G, 200M]: " _LVM_SIZE