How Scan LUN In Redhat Linux Vmware Guest OS

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
#

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.