Thursday, September 9, 2010

LINUX - New Device Addition & Deletion

Often we come across a situation where Storage was presented to the LINUX machine but the System admins are not to find the new device. There are some utilities from Qlogic and HP which help us to scan the new device but might not help in some situation. Use the below command to scan the new LUN. It helped me in almost 95% of the cases (had to reboot in the remaining).

#ls /sys/class/scsi_host

You will receive the list of scsi hosts on Linux machine

After that run the following command:
#echo "- - -" > /sys/class/scsi_host/host#/scan
where ‘host#’ should be changed to host name with number, received in previous command

#fdisk –l
#lvmdiskscan
#multipath -ll


Deleting a LUN from the host.

#multipath -ll
mpath5 (36006016037e02200a800e0558015df11) dm-9 DGC,RAID 5
[size=50G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
\_ round-robin 0 [prio=2][active]
\_ 2:0:1:1 sdg 8:96 [active][ready]
\_ 3:0:1:1 sdm 8:192 [active][ready]
\_ round-robin 0 [prio=0][enabled]
\_ 2:0:0:1 sdd 8:48 [active][ready]
\_ 3:0:0:1 sdj 8:144 [active][ready]

Note down the device name (dm) and the complete scsi address (Host #:SCSI channel:ID, LUN #) and execute the following
#pvremove /dev/dm-9
#echo "scsi remove-single-device 3 0 0 1" >/proc/scsi/scsi
Repeat the above for all scsi address

Once done then lvmdiskscan & multipath -ll won't show the disk. And now it can removed from the storage.

No comments: