Operating System - Linux
1821410 Members
2824 Online
109633 Solutions
New Discussion юеВ

command for detecting scsi LUNs

 
Chakravarthi
Trusted Contributor

command for detecting scsi LUNs

Hi all,

Is there a command to detect SCSI luns in linux without rebooting the machine?

regards
chakri
4 REPLIES 4
Marco_113
Frequent Advisor

Re: command for detecting scsi LUNs

try this command
ezix.sourceforge.net/software/lshw.html
Bye
Chakravarthi
Trusted Contributor

Re: command for detecting scsi LUNs

there is no command
xyko_1
Esteemed Contributor

Re: command for detecting scsi LUNs

Hi,

you don't need reboot all server.

You just have to modprobe -r xxxx (or rmmod xxxx) and after modprobe xxxx,

where xxxx is the module (driver) that supports your scsi device.

But remember that you have to unmount all scsi devices that are supported by the xxxx module.

To see if the module is in use or not, before you can remove it, you have to list all modules using lsmod and verify if the use count is zero.

Hope it helps.
regards,
Xyko
Colin Topliss
Esteemed Contributor

Re: command for detecting scsi LUNs

Depends on your distro.

On SuSE, you can use:
hwinfo (output too large to include here)

sginfo -l
/dev/sda /dev/sdb /dev/scd0 /dev/sr0
/dev/sg0 [=/dev/sda scsi0 ch=0 id=0 lun=0]
/dev/sg1 [=/dev/sdb scsi0 ch=0 id=1 lun=0]
/dev/sg2 [=/dev/scd0 scsi4 ch=0 id=0 lun=0]

sg_scan
/dev/sg0: scsi0 channel=0 id=0 lun=0 [em]
/dev/sg1: scsi0 channel=0 id=1 lun=0 [em]
/dev/sg2: scsi4 channel=0 id=0 lun=0 [em]

sg_map
/dev/sg0 /dev/sda
/dev/sg1 /dev/sdb
/dev/sg2 /dev/scd0

If you are trying to force a rescan of a SCSI bus (after hot-plugging a disk) - well, that isn't supported under kernel 2.4 - I'd have to check into 2.6. But you can add/remove devices on the fly:

Existing devices can be removed using echo "scsi remove-single-device " > /proc/scsi/scsi where the variables are host, bus (channel), target (scsi id) and lun. The success (or otherwise) of this command can be determined by sending a subsequent cat /proc/scsi/scsi command. The removal will fail if the device is busy (e.g. if a file system on the device is mounted).

New devices can be added using echo "scsi add-single-device " > /proc/scsi/scsi where the variables are host, bus (channel), target (scsi id) and lun. The success (or otherwise) of this command can be determined by sending a subsequent cat /proc/scsi/scsi command.


Col.