#!/bin/bash

# Bind partitions to raw devices
# (not persistent across system reboots)


# Bind /dev/hdf5 - /dev/hdf23 to /dev/raw/raw1 - /dev/raw/raw19
raw_devno=1
blk_devno=5
dev_to_bind=19
dev_bound_cnt=0

echo "
Query existing bindings:
"
# Display existing bindings
/usr/bin/raw -qa

echo "
Executing Oracle RAC bindings:
"

while [ $dev_bound_cnt -lt $dev_to_bind ]
do
    # Bind the partition
    /usr/bin/raw /dev/raw/raw$raw_devno /dev/hdf$blk_devno

    # Set permissions
    /bin/chmod 600 /dev/raw/raw$raw_devno
    /bin/chown oracle.dba /dev/raw/raw$raw_devno

    raw_devno=`expr $raw_devno + 1`
    blk_devno=`expr $blk_devno + 1`
    dev_bound_cnt=`expr $dev_bound_cnt + 1`
done

echo "
Query current bindings:
"
# Display additional bindings
/usr/bin/raw -qa


