Tags

11g (5) 12c (6) 18c (3) 19c (4) ASM (1) Critical Patch (11) Data Pump (1) Dataguard (9) Diverse (3) GRID (7) GitLab (2) Linux (8) OEM (2) ORA Errors (13) Oracle (12) RMAN (4)

Tuesday, April 20, 2021

Detect and Scan New LUNs on Linux

Detect and Scan New LUNs on Linux

 If LUN are not visible:

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

Identify existing LUNs

cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l

ll /dev/|grep oracle|wc -l


You can use the following command to have better output of all the disks

fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'

or

fdisk -l | grep sd


ls -l /dev/disk/by-path/

ls -l /dev/disk/by-id/scsi*

ls -l /dev/disk/by-id/scsi*|wc -l

ls -l /dev/disk/by-uuid/   <<== find the correct SCSI device

Find host bus number.

ls /sys/class/scsi_host


or

To find which host bus number is relevant.

grep mpt /sys/class/scsi_host/host?/proc_name

/sys/class/scsi_host/host1/proc_name:mptspi   <<== host1 is relevant and need to scan

Then you will scan every iscsi disk found and scan after every scanning if the new disk was detected. It means

scan each scsi host device

echo "- - -" > /sys/class/scsi_host/host1/scan

or

If you have too many hosts (from host0 to host20 for example), you can use the command below

# for host in `ls /sys/class/scsi_host/`;do
echo "- - -" >/sys/class/scsi_host/${host}/scan;

done

ls -l /dev/disk/by-id/scsi*|wc -l


To detect the LUN need to execute following command.

echo 1 > /sys/class/scsi_device/0\:0\:2\:0/device/rescan # put correct scsi id in this is 2

Or this command

rescan-scsi-bus.sh -a -w -m


--

Scan lun with multipath

vi /etc/multipath.conf

# LUNS Entry

multipaths {

     multipath {

                wwid 360050768018e02976000000000000v72

                alias TST_map_LUN_01

        }

}

service multipathd restart


multipath -l

/usr/bin/rescan-scsi-bus.sh -a -w -m

/usr/bin/rescan-scsi-bus.sh -a -w -r    # for deleting LUNs that no longer exist

service multipathd restart

 multipath -ll


mount Filesystem:

cd /dev/mapper/

ll

mkfs.xfs /dev/mapper/TST_map_LUN_01

Edit the entrty in /etc/fstab

/dev/mapper/TST_map_LUN_01         /data                   xfs     defaults        0 0

mount -a


No comments:

Post a Comment

physical standby without duplicate command

physical standby without duplicate command create a physical standby database using RMAN without using duplicate command PURPOSE:   All docu...