Monday, February 21, 2011

Managing HBAs and SAN disks in Redhat Linux 4 & 5

Redhat 5 :

To list the LUNs and their paths :
# multipath -ll

To display pv information on a multipath :
# pvdisplay /dev/mapper/mpath0

To find the server hardware details :
# dmidecode <- hardware info To scan for new LUNs: # ls /sys/class/fc_host host0 host1 # fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

# echo "1" > /sys/class/fc_host/host0/issue_lip

# echo "- - -" > /sys/class/scsi_host/host0/scan

# echo "1" > /sys/class/fc_host/host1/issue_lip

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

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

# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l



RHEL 4.6 :

To see HBA details like firmware, wwn,etc.. :
# cat /proc/scsi/qla2xxx/0

To list the HBAs along with their HBA :
# adapter_info

To scan for new LUNs:
# hp_rescan -a

To show the WWN of a LUN :
# scsi_info /dev/sdb


To list the configured Qlogic adapters:
# lspci | grep -i qlo


To list the LUNs:
# /opt/hp/hp_fibreutils/lssd

Output will be like

sda H,B,T,L

where
H is the host number of the HBA
B is the bus number (normally 0)
T is the target number
L is the LUN number
is a string which uniquely identifies the storage array.

To remove a lun from OS:
# echo "1" > /sys/block/sd/device/delete
# echo "scsi remove-single-device H B T L" > /proc/scsi/scsi
# echo "1" > /sys/class/scsi_host/host/device/targetH:B:T:L/H:B:T:L/delete