Commands and files:
View files to see what is loaded in kernel:
/proc/scsi/scsi - View scsi devices configured in kernel
/proc/scsi// - View hba configured device in kernel, mappings, driver version.
/proc/partitions -View partitions loaded in kernel.
Commands:
lspci - ListPCI devices
fdisk - Partition table manipulator
sfdisk - Partition table manipulator
parted - Partition table manipulator also used to configure EFI disks.
hdparm -Get/set hard disk parameters
blockdev - Call block device ioctls from the command line
badblocks - Check for bad blocks on device
lsmod - View loaded modules
modinfo - View module loaded parameters
scsi_id - Retrieve and generate a unique SCSI identifier
MAKEDEV - MAKEDEV is a program that will create the devices tree that interfaces with drivers in the kernel.
The following requires sg module be loaded and sg3_utils be installed
sg_map - displays mapping between sg and other SCSI devices
sg_scan - does a scan of sg devices (or given SCSI/ATAPI/ATA devices) and prints the results
sg_modes - reads SCSI MODE SENSE pages
sg_rbuf - reads data using SCSI READ BUFFER command
sg_reset - exercises SCSI device/bus/host reset capability
sg_senddiag - performs a SCSI SEND DIAGNOSTIC command
sg_readcap - calls a READ CAPACITY command on a SCSI device
sg_start - starts (spins-up) or stops(spins down) SCSI devices
sg_turs -executes a user specified number of TEST UNIT READY commands on the given device
sg_test_rwbuf - Tests the SCSI host adapter by issuing write and read operations on a device s buffer and calculatingchecksums.
sg_inq - outputs data retrieved from the SCSI INQUIRY command
sginfo - access mode page information for a SCSI (or ATAPI) device
sg_dd - copies data to and from sg and raw devices
sg_logs - reads SCSI LOG SENSE pages
Examples using the commands and files above:
1. Check which hba model and module is loaded. Note qla2xxx in the output below.
#lspci|grep -i fibre
0d:00.0 Fibre Channel: QLogic Corp. QLA2432 Fibre ChannelAdapter (rev 02)
0d:00.1 Fibre Channel: QLogic Corp. QLA2432 Fibre ChannelAdapter (rev 02)
# lsmod|grepscsi_mod
scsi_mod 141457 10scsi_dump,vxdmp,sr_mod,usb_storage,mptsas,mptspi,mptfc,mptscsi,sd_mod,qla2xxx
2.To view qlogic modules configurable parameters.
# modinfo qla2xxx
3. View qlogic version information on controller 0.
# cat/proc/scsi/qla2xxx/0|grep version
Firmwareversion 4.04.00 [IP] [84XX] , Driver version 8.02.14.01-fo
BIOS version1.08
FCODE version 1.13
EFI version 1.02
Flash FW version 4.00.120002
Note: Additional information can be viewed by viewing the file completely. SCSI Device Info, FC Port Info, FC Port Info, SCSI Lun Info and loaded parameters.
4. Mapping the LUN info by viewing/proc/scsi/qla2xxx/0. We will map LUN 0 with Id 1.
# cat/proc/scsi/qla2xxx/0|egrep "Id:Lun|1: 0"
(Id:Lun) * - indicates lun isnot registered with the OS.
( 1: 0): Total reqs 224197, Pending reqs 0, flags0x2, Dflags 0x0, 0:2:82 00
5. Mapping Id and LUN.
a. Verify sg_utils is loaded.
# rpm -aq |grep sg3_utils
b. Load the sg moduleand verify it loaded.
# modprobe sg
# lsmod|grep "sg"
sg 42617 0
c. Run sg_scan to view mappings. As we are looking at controller 0; thus grepping scsi0.
# sg_scan|egrep "scsi0 channel=0 id=1lun=0"
/dev/sg0: scsi0 channel=0 id=1 lun=0
Note: To get a list of controllers from a VxVM perspective. You can run the following.
# vxdmpadm listctlrall
CTLR-NAME ENCLR-TYPE STATE ENCLR-NAME
=====================================================
c0 EMC_CLARiiON ENABLED emc_clariion0
c2 Disk ENABLED disk
6. Identify which actual device belongs to scsi0 channel 0 id 1 and lun0. With sg_map
# sg_map|grepsg0
/dev/sg0 /dev/sda
7. Use the scsi,channel, id and lun numbers to view /proc/scsi/scsi and show vendor information.
# more /proc/scsi/scsi
Attached devices:
Host: scsi0Channel: 00 Id: 01 Lun: 00
Vendor: DGC Model:RAID 5 Rev: 0219
Type: Direct-Access ANSISCSI revision: 04
8. Display additional information using sginfo and sg_inq (similar to vxdmpinq)
# sginfo /dev/sda
INQUIRY reponse (cmd:0x12)
---------------------------
DeviceType 0
Vendor: DGC
Product: RAID 5
Revisionlevel: 0219
# sg_inq/dev/sda
standardINQUIRY:
PQual=0 Device_type=0 RMB=0 [ANSI_version=4] version=0x04
[AERC=0] [TrmTsk=0] NormACA=1 HiSUP=1 Resp_data_format=2
SCCS=0 ACC=0 ALUA=0 3PC=0 Protect=0
BQue=0 EncServ=0 MultiP=1 MChngr=0 [ACKREQQ=0] Addr16=0
[RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=1
Clocking=0x0 QAS=0 IUS=0
length=193(0xc1) Peripheral device type: disk
Vendor identification: DGC
Product identification: RAID 5
Product revision level: 0219
Productserial number: APM00064800091
9. Display the partition table.
a. List partition table in sectors.
# fdisk -ul/dev/sda
Disk /dev/sda (Sun disk label): 16 heads, 10 sectors, 44798cylinders
Units = sectors of 1 * 512 bytes
DeviceFlag Start End Blocks Id System
/dev/sda3 u 0 7167680 3583840 5 Wholedisk
/dev/sda8 u 0 7167680 3583840 f Unknown
b. Display the same information using parted.
# parted -s /dev/sda print
Warning: The disk CHS geometry(1023,113,62) does not match the geometry stored on the disk label (44800,16,10).
Disk geometry for /dev/sda: 0.000-3500.000megabytes
Disk label type:sun
Minor Start End Filesystem Flags
8 0.000 3499.843
Note: You can also use `sfdisk -l /dev/sda`, but fdisk and parted are the commands most commonly used.
10. Get hardisk information for sda using hdparm.
# hdparm /dev/sda
/dev/sda:
HDIO_GET_MULTCOUNT failed: Invalid argument
readonly = 0 (off)
readahead = 256 (on)
geometry = 1023/113/62, sectors = 3670016000, start =0
11. View the partition table loaded in kernel for device sda. This will show minor number association and current partitions actually visible and loaded in kernel. If its not here whatever fdisk shows you does not matter.
# cat /proc/partitions|egrep "minor|sda"
majorminor #blocks name
8 0 3584000 sda
8 3 3583840sda3
8 8 3583840 sda8
Note: You can use vxautconfig to get major minor info from vx point of view. Where dev shows major 8 with minor 0 for device sda.
# /etc/vx/diag.d/vxautoconfig|grep sda
sda dev=8/0 ctlr=0
12. You can re-read the partition table by issuing the following command. If the device issued by VxVM then the command will return busy. Remove the disk from vxvm using the command `vxdisk rm` command.
# vxdisk -e list |egrep "sda|OS"
DEVICE TYPE DISK GROUP STATUS OS_NATIVE_NAME ATTR
sda auto - - online sda -
# vxdisk rm sda
#blockdev --rereadpt /dev/sda
# The following will display in/var/log/messages after running the above command.
Jul 10 11:54:11sprs1950a0-28 kernel: SCSI device sda: 7168000 512-byte hdwr sectors (3670MB)
Jul 10 11:54:11 sprs1950a0-28 kernel: SCSI device sda: drive cache:write through
Jul 10 11:54:11 sprs1950a0-28 kernel: sda: sda3sda8
13. Check for bad blocks on the disk. Use non-destructive read-write mode. Show the progress of the scan. Verbose mode.
# badblocks -svn /dev/sda
Checking for badblocks in non-destructive read-write mode
From block 0 to3584000
Checking for bad blocks (non-destructive read-writetest)
Testing with random pattern: done
Pass completed, 0 bad blocksfound.
14. Idnetify the UDID using the command scsi_id.
a. Since scsi_id requires /block/sda, create this device.
/sbin/MAKEDEV -d /block sda
b.Run scsi_id to retreive the scsi udid.
# /sbin/scsi_id -g -u -s/block/sda
360060160c68218003ca6804ba99edc11
c. This will be the same as the VERITAS UDID.
# vxdisk list sda|grepudid
udid: DGC%5FRAID%205%5FAPM00064800091%5F60060160C68218003CA6804BA99EDC11
15.How to associate the VxDMP device seen in /proc/partitions with the dmp node seen in /dev/vx/dmp. Using sda as an example.
a. Display the device view from vxdisk list. The Command below ensures the OS_NATIVE_NAME is the same as the DEVICE name.The real device is always OS_NATIVE_NAME. Sometimes due to VxVM persistent naming they may differ.
# vxdisk -e list|egrep"OS|sda"
DEVICE TYPE DISK GROUP STATUS OS_NATIVE_NAME ATTR
sda auto - - online sda -
b. Display the DMP major minor and OS_NATIVE device major minor. Note DMP will build major and minor numbers for the base device and partitions 1-15 which is the max allowed on Linux.
# ls-al /dev/vx/dmp|grep "sda"
brw------- 1 root root 201, 128 Jul 1011:57 sda
brw------- 1 root root 201, 129 Jul 10 11:57sda1
brw------- 1 root root 201, 138 Jul 10 11:57sda10
brw------- 1 root root 201, 139 Jul 10 11:57sda11
brw------- 1 root root 201, 140 Jul 10 11:57sda12
brw------- 1 root root 201, 141 Jul 10 11:57sda13
brw------- 1 root root 201, 142 Jul 10 11:57sda14
brw------- 1 root root 201, 143 Jul 10 11:57sda15
brw------- 1 root root 201, 130 Jul 10 11:57sda2
brw------- 1 root root 201, 131 Jul 10 11:57sda3
brw------- 1 root root 201, 132 Jul 10 11:57sda4
brw------- 1 root root 201, 133 Jul 10 11:57sda5
brw------- 1 root root 201, 134 Jul 10 11:57sda6
brw------- 1 root root 201, 135 Jul 10 11:57sda7
brw------- 1 root root 201, 136 Jul 10 11:57sda8
brw------- 1 root root 201, 137 Jul 10 11:57 sda9
c. View the /proc/partitions to get an association between VxDMP and the device. The VxDMP device names will be seen in /var/log/messages when paths are disabled/enabled.
# cat /proc/partitions |grep 201|grep 128
201 128 3584000 VxDMP9