Storage commands

Scaning for new disks

  1. Manual scan

a) Classic scan for LUNs and virtual disks

for i in `ls -1 /sys/class/scsi_host/`; do echo "- - -" > /sys/class/scsi_host/$i/scan; done

b) Extend a new disk in VMware on RHEL[5-7]

echo 1 > /sys/block/sda/device/rescan

c) Scan for a new virtual disk in VMware on RHEL 3

cat /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
cat /proc/scsi/scsi
  1. yum install sg3_utils

rescan-scsi-bus.sh

  1. QLogic FC HBA LUN Scan Utility for Qlogic HBAs
  • Re-scan all the HBAs: ./ql-dynamic-tgt-lun-disc.sh
  • Invoke the menu: ./ql-dynamic-tgt-lun-disc.sh -i
  • Re-scan and remove any lost LUNs: ./ql-dynamic-tgt-lun-disc.sh -s -r

http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/ResourceByOS.aspx?productid=924&oemid=65&oemcatid=58604

  1. Fibreutils

hp_rescan

http://h20564.www2.hpe.com/hpsc/swd/public/detail?swItemId=MTX_0fe5289cad1a4ca4938a9c03d5

  • Port state (RHEL 5-7) : for i in `ls /sys/class/fc_host/host*/port_state`; do echo $i; cat $i; done
  • WWN: for i in `ls /sys/class/fc_host/host*/port_name`; do echo $i; cat $i; done or for i in /sys/class/fc_host/host[0-9]/port_name; { echo -n "$i : "; cat $i; }
  • Speed: for i in `ls /sys/class/fc_host/host*/speed`; do echo $i; cat $i; done
  • List HBAs: lspci | grep -i fibre
  • Details about HBA: lspci -v -s 03:00.1
  • Find PCI slot and scsi_host mapping: ls -l /sys/class/scsi_host
  • Find HBA port for a LUN: udevadm info --query=path --name /dev/sdf or ls -l /dev/disk/by-path/
  • HBA model description: cat /sys/class/scsi_host/host0/modeldesc
  • HBA ROM version: cat /sys/class/scsi_host/host0/option_rom_version
  • HBA firmware version: cat /sys/class/scsi_host/host0/fwrev
  • Get disk size in sectors (512 bytes): blockdev --getsize /dev/mapper/mpathd
  • Get disk size in bytes: blockdev --getsize64 /dev/mapper/mpathd
  • Show queue depth: cat /sys/block/sd[X]/device/queue_depth
  • Show number of requests: cat /sys/block/sd[X]/queue/nr_requests

  • Create a LVM partition on a disk on RHEL 6

cat << EOF | fdisk -cu /dev/sdb
> n
> p
> 1
>
>
> t
> 8e
> w
> EOF

Tools

inq

adapter_info (fibreutils)

SANsurfer FC HBA CLI (scli )

Download the tool from Qlogic page

yum install scli-1.7.2-7.i386.rpm glibc.i686

emcgrab

cd /opt
wget ftp://ftp.emc.com/pub/emcgrab/Unix/emcgrab_Linux_v4.7.10.tar
tar -xvf emcgrab_Linux_v4.7.10.tar
cd emcgrab
./emcgrab.sh
ls -l outputs