Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Automatization of LVM Test LAB
#!/bin/bash
receptor=$1
echo $receptor
fdisk_lvm_cmd="n
p
1
#\n
#\n
t
8e
w
q"
ext4_cmd="n
p
1
#\n
#\n
w
q"
lvm_exec(){
disks=("a" "b" "c" "d" "f")
counter=0
cant="${#disks[*]}"
read -p "Opcion de formateo 1(LVM), 0(Default EXT 4): " receptor
while [ $counter -lt $cant ]
do
if [[ $receptor == 1 ]]; then
echo "validacion para lvm"
sudo -S sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' <<< $fdisk_lvm_cmd | sudo -S fdisk /dev/sd${disks[$counter]} >> results.log
((counter ++));
else
echo "validacion para ex4"
sudo -S sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' <<< $ext4_cmd | sudo -S fdisk /dev/sd${disks[$counter]} >> results.log
((counter ++));
fi
done
}
lvm_exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment