RHEL: Handling SCSI disks

# Tested on RHEL 5, 6 & 7


# Check devices currently known to the SCSI subsystem
# ------------------------------------------------------------------------------------------

cat /proc/scsi/scsi
   Attached devices:
   Host: scsi0 Channel: 00 Id: 00 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02
   Host: scsi0 Channel: 00 Id: 01 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02


# NOTE: 'lsscsi' command can be used to display disks attached to server



# Identify a disk using 'scsi_id' command
# ------------------------------------------------------------------------------------------

# 'scsi_id' queries a SCSI device via the SCSI INQUIRY vital product data (VPD)
# page 0x80 or 0x83 and uses the resulting data to generate a value that is
# unique across all SCSI devices that properly support page 0x80 or page 0x83.

# It may be useful, for instance, to identify a disk shared by two nodes:

hostA:/#> scsi_id --page=0x83 --whitelisted --device=/dev/sdd
   36000c290d59b294f402f949a10afd541

hostB:/#> scsi_id --page=0x83 --whitelisted --device=/dev/sde
   36000c290d59b294f402f949a10afd541

# Depending on RHEL version, parameters and command location may vary slightly.
# More information about command usage:
# https://sites.google.com/site/syscookbook/rhel/rhel-scsi-identifier-show


# Add a SCSI disk to the system
# ------------------------------------------------------------------------------------------

# On this server we have: Host=0 (scsi0), Channel=0, Id=[0|1] and Lun=0  For a new disk
# we have to use, then, path 0.0.2.0 - SCSI(0:2).
# Once new disk has been attached/added to server, run following command to discover it:

echo "0 2 0" > /sys/class/scsi_host/host0/scan

# NOTE: We may know that host0 is the one to be used taking a look to the contents
#       of /proc/scsi/scsi file. In this case all disks are attached to scsi0 (host0)

# Alternatively we can run following commands in order to run a complete rescan:

for i in /sys/class/scsi_host/host*/scan; do echo "- - -" > $i; done



# Check

cat /proc/scsi/scsi
   Attached devices:
   Host: scsi0 Channel: 00 Id: 00 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02
   Host: scsi0 Channel: 00 Id: 01 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02
   Host: scsi0 Channel: 00 Id: 02 Lun: 00                              <--
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02


lvmdiskscan
     /dev/ramdisk [       16.00 MB]
     /dev/root    [        8.00 GB]
     /dev/ram     [       16.00 MB]
     /dev/sda1    [      258.83 MB]
     /dev/dm-1    [       64.00 MB]
     /dev/ram2    [       16.00 MB]
     /dev/sda2    [      258.86 MB]
     /dev/dm-2    [        2.00 GB]
     /dev/ram3    [       16.00 MB]
     /dev/sda3    [       41.49 GB] LVM physical volume
     /dev/dm-3    [        2.00 GB]
     /dev/sdb     [       45.00 GB] LVM physical volume
   [...]
     /dev/sdc     [       20.00 GB]                      <--
     4 disks
     37 partitions
     1 LVM physical volume whole disk
     1 LVM physical volume


fdisk -l
[...]
   Disk /dev/sdc: 21.4 GB, 21474836480 bytes
   255 heads, 63 sectors/track, 2610 cylinders
   Units = cylinders of 16065 * 512 = 8225280 bytes

   Disk /dev/sdc doesn't contain a valid partition table



# Remove a SCSI disk from the system
# ------------------------------------------------------------------------------------------

# To remove a disk from server, once it has been removed from VG, etc, run following command:

echo 1 > /sys/block/<sdc>/device/delete


# Check

cat /proc/scsi/scsi
   Attached devices:
   Host: scsi0 Channel: 00 Id: 00 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02
   Host: scsi0 Channel: 00 Id: 01 Lun: 00
     Vendor: VMware   Model: Virtual disk     Rev: 1.0
     Type:   Direct-Access                    ANSI SCSI revision: 02
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
Viewed 11929 times since Thu, Jul 19, 2018
Red Hat 8 How to Set Up Automatic Updates for CentOS 8
Viewed 3339 times since Fri, Sep 25, 2020
Manage Linux Password Expiration and Aging Using chage
Viewed 4278 times since Tue, Sep 11, 2018
Increase A VMware Disk Size (VMDK) Formatted As Linux LVM without rebooting
Viewed 15008 times since Wed, May 30, 2018
RHEL: Displaying/setting kernel parameters - ’sysctl’
Viewed 2647 times since Sat, Jun 2, 2018
RHEL: XFS basic operations
Viewed 15477 times since Sat, Jun 2, 2018
SPRAWDZONA KONFIGURACJA RSYSLOG I LOGROTATE, JAKO ZEWNĘTRZNEGO SERWERA SYSLOG
Viewed 3493 times since Fri, Nov 30, 2018
Linux - How to monitor CPU usage
Viewed 6136 times since Fri, Jun 8, 2018
Using renice and taskset to manage process priority and CPU affinity with Linux OEL 6.4
Viewed 3304 times since Mon, Feb 17, 2020
HOWTO: Use SSL/port 465 in smarthost stunnel
Viewed 3453 times since Fri, Sep 28, 2018