New Oracle ASM Disks Mapping in RHEL

cd /root/asm/

###start of infomation collection script named collect_info.sh
#!/bin/ksh

currentdatetime=$(date +”%T”.”%Y%m%d”)

echo “”
echo “############################################”
echo “# #”
echo “# LINUX – ASM Disk – Backup Informations #”
echo “# #”
echo “############################################”
echo “”

echo ” ##### Collecting informations ##### ”
ls -l /dev/disk/by-id/ > diskbyidbef.$currentdatetime
ls -l /dev/disk/by-id/ | grep -i scsi- > diskbywwnidbef.$currentdatetime
multipath -ll > mpathidbef.$currentdatetime

echo ” ##### Backup configurations file ##### ”
cp -p /etc/udev/rules.d/99-oracle-asmdevices.rules /etc/udev/rules.d/99-oracle-asmdevices.rules.$currentdatetime
echo “Backup 99-oracle-asmdevices.rules to /etc/udev/rules.d/99-oracle-asmdevices.rules.$currentdatetime …”
cp -p /etc/multipath.conf /etc/multipath.conf.$currentdatetime
echo “Backup multipath.conf to /etc/multipath.conf.$currentdatetime …”
echo ” ##### Verify file existence ##### ”
ls -l /etc/udev/rules.d/99-oracle-asmdevices.rules.$currentdatetime
ls -l /etc/multipath.conf /etc/multipath.conf.$currentdatetime
########end of script for collect_info.sh

########start of device scanning script named device_scan.sh
#!/bin/ksh

currentdatetime=$(date +”%T”.”%Y%m%d”)

echo “”
echo “############################################”
echo “# #”
echo “# LINUX – ASM Disk – Device Scanning #”
echo “# #”
echo “############################################”
echo “”

echo ” ##### Collecting informations ##### ”
for i in `cat fc `; do echo “- – -” > /sys/class/scsi_host/$i/scan; echo $i; done

echo ” ##### Gather informations after scanning ##### ”
ls -l /dev/disk/by-id/ > /root/asm/diskbyidaft.$currentdatetime
echo “Save current informations to /root/asm/diskbyidaft.$currentdatetime…”
ls -l /dev/disk/by-id/ | grep -i scsi- > /root/asm/diskbywwnidaft.$currentdatetime
echo “Save current informations to /root/asm/diskbywwnidaft.$currentdatetime…”
multipath -ll > /root/asm/mpathidaft.$currentdatetime
echo “Save multipath informations after scanning to /root/asm/mpathidaft.$currentdatetime…”
#######end of device scanning script named device_scan.sh

#shows newly added disks wwn no
diff diskbywwnidbef.$currentdatetime diskbywwnidaft.$currentdatetime

vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL==”dm-*”, PROGRAM=”scsi_id –page=0x83 –whitelisted –device=/dev/%k”, RESULT==”new wwn”, SYMLINK+=”oracleasm/disks/new_asm_disk_data”, OWNER:=”oracle”, GROUP:=”dba”, MODE=”0660″

#reload udev rules
udevadm control –reload-rules
udevadm trigger

List the Mapped disks
# ls -l /dev/oracleasm/disks