Wednesday 18 May 2011

SCSI harddisk on linux

Manually:
cat /proc/scsi/scsi
ls /sys/class/scsi_host/.....
==> contain the host:bus:ID:Lun and Port name

By command:
lsscsi (many flag options)
fdisk -l
sginfo

Note : /dev/sdX mapped from /dev/sgX

When a HBA attach to SAN which contain 4 logical disks:
/dev/sdb,c,d,e (the partner is /dev/sdf,g,h,i)

How to see the partner :
e2label /dev/sdb XXX ==> to lable the HD
e2label /dev/sdf --> to see if it has same lable or not

Will be like this :
H:B:I:L == 5.0.0.1,2,3 (for sdb,c,d,e) and 5.0.1.1,2,3,4 (for the partner)

H is host, same as comes from one HBA. (diffrent from CDROM and LOCAL HD as it connects from different card)

B is BUS : dunno what
I is ID : same for LUNS (show same S/N of harddisk)
L is LUN : different for each partition/logical disks

additional commands:
hdparm
sdparm
scsi_id
parted /dev/sdX print ==> to see File System of a harddisk
rescan_scsi_bus.sh