LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Deecting luns - Any explaination for the command (https://www.linuxquestions.org/questions/linux-newbie-8/deecting-luns-any-explaination-for-the-command-4175483240/)

piradeep 11-03-2013 06:08 AM

Deecting luns - Any explaination for the command
 
I recently had an opportunity to see how luns are scanned. Just need help in understanding the below command.

# echo "- - -" > /sys/class/scsi_host/host1/scan

I am not sure what "- - -" explains? Anyone?

Disillusionist 11-03-2013 06:30 AM

The /sys folder in Linux is special in that the files in the structure are intended to provide an interface with the Linux kernel directly.

As such, when you are writing "- - -" to the /sys/class/scsi_host/host1/scan special file, you are sending a request to the Linux kernel to scan the scsi connections on the scsi bus "host1"

piradeep 11-03-2013 06:40 AM

Thanks a lot. And, what if we give "1" instead of "- - -". Does it make any difference?

Disillusionist 11-03-2013 06:48 AM

I would imagine that the kernel developers decided to use "- - -" specifically and that it would not accept other input.

Ser Olmy 11-03-2013 06:58 AM

Each SCSI controller can have a number of buses, each bus can serve a number of devices, and each device can have one or more Logical Units.

The dashes act as wildcards. "- - -" simply means "scan all buses, all devices and all LUNs". The string "0 - -" would mean "scan all devices and LUNs on bus 0", while "- - 0" would mean "scan LUN 0 on all devices on all buses".

If you try to reference a non-existent bus/device/LUN, echo will return "write error: Invalid argument".

piradeep 11-10-2013 11:02 PM

Thank you very much.


All times are GMT -5. The time now is 08:48 PM.