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

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

  1. Fibreutils


  • 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



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


cd /opt
tar -xvf emcgrab_Linux_v4.7.10.tar
cd emcgrab
ls -l outputs