How Scan LUN In Redhat Linux Vmware Guest OS

February 23, 2011 | By
| Reply More

Storage Linux

In this blog, I am trying to give some examples that show how to scan LUN from a Redhat Linux Vmware Guest OS (This example is from RHEL3). Once LUNs are mapped for VM's, it should be made visible to the OS. Below article explains and helps to scan and identify the disks/LUNs that are mapped with RHEL3. Below command will display the available LUNS attached to the OS and its status.

# cat /proc/scsi/sg/devices
host chan id lun type opens qdepth busy online
0 0 0 0 0 5 28 0 1
0 0 1 0 0 1 28 0 1
0 0 2 0 0 1 28 0 1

# 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

This will scan scsi for mapped LUNs

#echo “scsi add-single-device 0 0 3 0″>/proc/scsi/scsi

Now you can see new LUN added to the file or to the OS.

# 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
Host: scsi0 Channel: 00 Id: 03 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02

Below fdisk command helps to find disk native url and disk details. You can try this command before and after the lun scan.

# fdisk -l 2>/dev/null | egrep ‘^Disk’ | egrep -v ‘dm-’
Disk /dev/sda: 12.5 GB, 12582912000 bytes
Disk /dev/sdb: 37.7 GB, 37748736000 bytes
Disk /dev/sdc: 38.6 GB, 38654705664 bytes
Disk /dev/sdd: 53.6 GB, 53687091200 bytes
#

Filed Under : LINUX HOWTO, STORAGE

Tagged With : ,

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.