Linux has a four level hierarchical addressing scheme for SCSI devices:
-
SCSI adapter number [host]
-
channel number [bus]
-
id number [target]
- lun [lun]
"Lun" is the common SCSI abbreviation of Logical Unit Number. The terms in
brackets are the name conventions used by device pseudo file system (devfs).
"Bus" is used in preference to "channel" in the description below.
The SCSI adapter number is typically an arbitrary numbering of the adapter
cards on the internal IO buses (e.g. PCI, PCMCIA, ISA etc) of the computer. Such
adapters are sometimes termed as HBAs (host bus adapters). SCSI adapter numbers
are issued by the kernel in ascending order starting with 0.
Each HBA may control one or more SCSI buses.
Each SCSI bus can have multiple SCSI devices connected to it. In SCSI
parlance the HBA is called the "initiator" and takes up one SCSI id number
(typically 7). The initiator talks to targets which are commonly known as SCSI
devices (e.g. disks). On SCSI parallel buses the number of ids is related to the
width. 8 bit buses (sometimes called "narrow") can have 8 SCSI ids of which 1 is
taken by the HBA leaving 7 for SCSI devices. Wide SCSI buses are 16 bits wide
and can have a maximum of 15 SCSI devices (targets) attached. The SCSI 3 draft
standard allows a large number of ids to be present on a SCSI bus.
Each SCSI device can contain multiple Logical Unit Numbers (LUNs). These are
typically used by sophisticated tape and cdrom units that support multiple
media.
<scsi(_adapter_number), channel, id, lun>
|
Using the naming conventions of devfs
this becomes:
<host, bus, target, lun> |
So now we discuss how to add LUN to a SAN File System. First Check the availabe SCSI devices which are available via /proc/scsi/scsi :
[root@home]# cat /proc/scsi/scsi
Attached devices: Host: scsi0 Channel: 00 Id: 02 Lun: 00 Vendor: PIONEER Model: DVD-ROM DVD-303 Rev: 1.10 Type: CD-ROM ANSI SCSI revision: 02 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: IBM Model: DNES-309170W Rev: SA30 Type: Direct-Access ANSI SCSI revision: 03
Attached devices: Host: scsi0 Channel: 00 Id: 02 Lun: 00 Vendor: PIONEER Model: DVD-ROM DVD-303 Rev: 1.10 Type: CD-ROM ANSI SCSI revision: 02 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: IBM Model: DNES-309170W Rev: SA30 Type: Direct-Access ANSI SCSI revision: 03
If you are not able to view the new
LUN then you need to redo a SCSI scan :
type the following to
send a rescan request:
[root@home]# echo "- - -" > /sys/class/scsi_host/host0/scan
where host0
is replaced by the HBA
you wish to use.
To find the host number you can execute the command
ls /sys/class/scsi_host/
To find the host number you can execute the command
ls /sys/class/scsi_host/
The wildcards "- - -" mean to look at every channel, every target, every lun.If you wanted to scan one specific value for one of those, you'd use it instead of the dash; the dash tells the driver to do all channels, targets, or LUNs.
You can also do a
fabric rediscover with the command :
[root@home]# echo "1" >
/sys/class/fc_host/ host0
/issue_lip
This operation will
perform a LIP (Loop Initialization Protocol) that causes the SCSI layers to be
updated and reflect the devices that are currently on the bus.
[root@home]# fdisk -l
[root@home]# tail -f /var/log/message
Record the ID:LUN combination for
any LUN that is not yet registered with the operating system.
Now to add a single
device explicitly, use the following syntax:
# echo "scsi add-single-device <H> <B> <T>
<L>" > /proc/scsi/scsi
Where,
- <H> : Host
- <B> : Bus (Channel)
- <T> : Target (Id)
- <L> : LUN numbers
For e.g. add /dev/sdc
with host # 0, bus # 0, target # 2, and LUN # 0, enter:
[root@home]# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
[root@home]# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
To force the Subsystem Device Driver
(SDD) to rescan and map the new devices, enter the following command at the
system prompt:
[root@home]#usr/sbin/cfgvpath
To verify that the LUN was added before a metadata server is up, you can enter the cat proc/partitions command. After a metadata server is up, you can enter the lslun command to view the list of LUNs available to SAN File System.
[root@home]# fdisk -l
New Lun is
now added to the SAN file system, check the status with Command :
[root@home]# cat /proc/scsi/scsi
Note that this document comes without warranty of any kind. But every effort
has been made to provide the information as accurate as possible. I welcome
emails from any readers with comments, suggestions, and corrections at
webmaster_at admin@linuxhowto.in
Copyright © 2012 LINUXHOWTO.IN
Copyright © 2012 LINUXHOWTO.IN
Thank you for such a wonderful Information !!
ReplyDeleteHere is a list of Top LINUX INTERVIEW QUESTIONS
SAMBA Server Interview Questions
Linux FTP vsftpd Interview Questions
SSH Interview Questions
Apache Interview Questions
Nagios Interview questions
IPTABLES Interview Questions
Ldap Server Interview Questions
LVM Interview questions
Sendmail Server Interview Questions
YUM Interview Questions
NFS Interview Questions
Read More at :- Linux Troubleshooting