Operating System - Linux
1748148 Members
3572 Online
108758 Solutions
New Discussion юеВ

how can iscsi initiator map a LUN to a specific drive

 
SOLVED
Go to solution
iinfi1
Super Advisor

how can iscsi initiator map a LUN to a specific drive

i am a novice Linux admin and our office does not have a storage box. i am using openfiler as a storage to practice different stuff which need common storage.

i am practicing clustering with RHEL5.3 and facing an issue with mapping common storage with the RHEL 5.3 nodes.
i tried to create a 2 node cluster and here is what i am facing.
i created 3 LUNs on my openfiler and ran the following commands on both nodes.
iscsiadm --mode discovery --type sendtargets --portal 192.168.1.10

when i ran fdisk -l on each node i find that the LUNs are mapped but they are not in correct sequence
on node 1 -- LUN1 -- /dev/sdb
on node 1 -- LUN2 -- /dev/sdc
on node 1 -- LUN3 -- /dev/sdd

but on node 2
on node 2 -- LUN1 -- /dev/sdb
on node 2 -- LUN3 -- /dev/sdc
on node 2 -- LUN2 -- /dev/sdd

/dev/sdc and /dev/sdd are swapped. i am not too sure whether things would work right when i configure any application on the cluster.

is there a way to map a LUN to a specific drive? like map LUN 1 to /dev/sdb and LUN2 to /dev/sdc and so on so that consistency can be maintained on all nodes.
5 REPLIES 5
Patrick Terlisten
Honored Contributor
Solution

Re: how can iscsi initiator map a LUN to a specific drive

Hello,

you can use UUID for mounting filesystems. Every partition/ volume has a unique id. You can dump the id by using dumpe2fs.

For example:

root@server:/ > dumpe2fs /dev/hda3

Take a look at the "Filesystem UUID". You can use this number in the /etc/fstab. An entry in the fstab can look like this:

UUID=1580b1ce-c62f-4dd1-aa48-d2584d43788b / ext3 acl,user_xattr 1 1

By using UUID you can get rid of changing device names.

Best regards,
Patrick

Best regards,
Patrick
iinfi1
Super Advisor

Re: how can iscsi initiator map a LUN to a specific drive

thank you mate..
i will try this first thing tomorrow. :)
iinfi1
Super Advisor

Re: how can iscsi initiator map a LUN to a specific drive

well mate,
thanks for your reply ..
but i am facing a few issues.

when i do a cluster i will need raw partitions
i dont think i can get the UUID for the raw partitions.

further i tried to create a dummy cluster after formatting a partition with ext3.
i formatted it from node1. mounted it on node1
then unmounted it on node1
and when i try to mount it on node 2 i get a message saying
[root@node2 ~]# mount /dev/sdb1 /shared/data/
mount: special device /dev/sdb1 does not exist

i know my steps are not completely correct. still a novice n struggling.
i referred this
http://www.idevelopment.info/data/Unix/Linux/LINUX_ConnectingToAniSCSITargetWithOpen-iSCSIInitiatorUsingLinux.shtml

search for the string " Create the following rules file /etc/udev/rules.d/55-openiscsi.rules on the client node linux3: "
in the article. i didnt understand how to to go about it.
is there any other way to do it?
Patrick Terlisten
Honored Contributor

Re: how can iscsi initiator map a LUN to a specific drive

Hello,

the howto (the link that you've posted) describes a way with UDEV and a little script. Most distributions use UDEV to create the /dev filesystem. One nice thing of UDEV is the possibility to manipulate it by scripts or simple config files.

The script and the UDEV rule in the howto are used to map iSCSI devices to common names, not device names like /dev/sdb etc. This could be a solution for your problem.

Best regards,
Patrick
Best regards,
Patrick
iinfi1
Super Advisor

Re: how can iscsi initiator map a LUN to a specific drive

thank you .. i was not able to completely understand the script, hence posted.
i will go over it again and see how things go.
thank you again