Tuesday, September 4, 2012

Adding new LUN dynamically in CentOS

After adding the new LUN(s) from SAN to CentOS Linux,

Step 1: Run the the command “rescan-scsi-bus.sh” , to dynamically detect and activate the new LUN. To understand this utility "rescan-scsi-bus.sh, see Scanning for SCSI new devices dynamically on CentOS

# /usr/bin/rescan-scsi-bus.sh -l

Host adapter 0 (aacraid) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (ata_piix) found.
Host adapter 3 (qla2xxx) found.
Host adapter 4 (qla2xxx) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, LUNs Scanning 
0 1 2 3 4 5 6 7
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: ServeRA  Model: A                Rev: V1.0 
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 1 0 0 ...
OLD: Host: scsi0 Channel: 01 Id: 00 Lun: 00
      Vendor: IBM-ESXS Model: VPA146C3-ETS10 N Rev: A650
      Type:   Direct-Access                    ANSI SCSI revision: 05
.....
.....
..... 
0 new device(s) found.
0 device(s) removed.
Since LUN are not physical disk, there may not be "new devices" detected, but look at the middle of the information "Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, LUNs  0 1 2 3 4 5 6 7"


Step 2: Verify the LUN has been added. You the command lsscsi. If you do not have the utility, do a yum install

# yum install lsscsi

# lsscsi

..... 
.....
[3:0:0:0]    disk    IBM      1814      FAStT  0916  /dev/sdb
[3:0:0:1]    disk    IBM      1814      FAStT  0916  /dev/sdc
[3:0:0:2]    disk    IBM      1814      FAStT  0916  /dev/sdd
[3:0:0:3]    disk    IBM      1814      FAStT  0916  /dev/sde
[3:0:0:4]    disk    IBM      1814      FAStT  0916  /dev/sdf
[3:0:0:5]    disk    IBM      1814      FAStT  0916  /dev/sdg
[3:0:0:6]    disk    IBM      1814      FAStT  0916  /dev/sdn
.....
.....

Alternatively, you can use the command fdisk -l to check whether your LUN is represented in the /dev directory like /dev/sd*
# fdisk -l

.....
.....
Disk /dev/sdr: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdr1               1       65270   524281243+  83  Linux

Disk /dev/sds: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sds1               1       65270   524281243+  83  Linux

No comments: