How to Scan Lun on Vmware Running Redhat Linux Guest OS

Storage Linux

In this tutorial, I will 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 commands helps to scan and identify the disks/LUNs that are mapped with RHEL3.

1)  Display the available attached LUNS

Below command will display the available LUNS that is already visible to the OS.

# 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

2) Scan scsi device

This will scan scsi for mapped LUNs

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

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

where,

- "0 0 3 0" =  "Host, Channel, ID, LUN"

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

You can also use fdisk command to find disk native url and disk details.

# 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
#

Read Also:

Bobbin Zachariah 4:09 pm

Comments

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

All comments are subject to moderation.