mount | grep "$diskfullname" > /dev/null
if [ $? -ne 0 ]
then
echo "$?"
# Check if partition exists
lsblk | grep "${diskname}[1-9]" > /dev/null
if [ $? -ne 0 ]
then
# Create on full partition
echo -e 'o\nn\np\n1\n\n\nw' | fdisk $diskfullname
sync
fi
# check partion suffix
lsblk | grep ${diskname}p1 > /dev/null
if [ $? -ne 0 ]
then
partname="${diskfullname}1"
else
partname="${diskfullname}p1"
fi
# check if it is a asm disk
diskno=`expr ${diskno} + 1`
/usr/sbin/oracleasm querydisk ${partname} | grep "marked an ASM disk" > /dev/null
if [ $? -ne 0 ]
then
/usr/sbin/oracleasm createdisk ASMDISK$diskno ${partname}
fi
Some debug code here with partially tested update - was abandoned due to need to get the db instance up `#!/bin/bash
--------
Main
--------
/usr/sbin/oracleasm configure -u oracle -g oinstall -b -s y -e
let diskno=0 fdisk -l | grep ^Disk\ /dev | grep -v mapper | cut -d' ' -f2 | cut -d: -f1 | while read diskfullname do diskname=
echo $diskfullname | awk -F"/" '{print $NF}'
echo $diskfullname echo $disknamecheck if disk/partition is mounted
mount | grep "$diskfullname" > /dev/null if [ $? -ne 0 ] then echo "$?"
fi done
Restart oracleasm
oracleasm init`