问题原文
原帖链接 · SQA777 · CC BY-SA 3.0
I have two iSCSI target servers. The iSCSI Initiator is an Ubuntu host (Ubuntu 14.04). I am using Ubuntu's open-iscsi to mount the iSCSI targets from both iSCSI targets servers to my Initiator.
The problem is that the symlinks in /dev/disk/by-id are "overwritten".
When I do the iscsiadm discovery and the iscsiadm -m node -l command to the first iSCSI target server, the targets are mounted and there are symlinks under /dev/disk/by-id.
For example, doing an ls -l /dev/disk/by-id after logging in to the first iSCSI target server might show the following:
scsi-3600000e00010001 -> ../../sdc
scsi-3600000e00010002 -> ../../sdd
scsi-3600000e00010003 -> ../../sde
wwn-0x60000e00010001 -> ../../sdc
wwn-0x60000e00010002 -> ../../sdd
wwn-0x60000e00010003 -> ../../sde
After doing a discovery and a login to the 2nd iSCSI target server (without logging out of the iSCSI target server), doing an ls -l /dev/disk/by-id shows something like this:
scsi-3600000e00010001 -> ../../sdaa
scsi-3600000e00010002 -> ../../sdab
scsi-3600000e00010003 -> ../../sdac
wwn-0x60000e00010001 -> ../../sdaa
wwn-0x60000e00010002 -> ../../sdab
wwn-0x60000e00010003 -> ../../sdac
1) I checked that all the iSCSI targets are mounted on the Ubuntu initiator by issuing an fdisk -l command. The iSCSI targets are all mounted.
2) But the symlinks point to targets from the 2nd server now. It looks like the symlinks to the targets from the 1st server were overwritten by symlinks to the 2nd server.
Is it possible to have all the iSCSI targets, from both iSCSI target servers, have separate symlinks and be listed under /dev/disk/by-id?
I am not an iSCSI expert so I thought I'd ask. I Googled this problem and searched for relevant tags here but I didn't see any answers. Maybe I am not configuring something correctly?
A workaround would be for me to write a script that ccreates individual, unique symlinks for all the iSCSI targets but I'd first like to see if I am misconfiguring something.
已采纳解答
原帖链接 · SQA777 · CC BY-SA 3.0
I found the answer to this.
For iSCSI targets that are on an Ubuntu, you have to edit the target's configuration file at: /etc/tgt/conf.d/1.conf
In the file 1.conf, the configuration information is stored in an HTML format.
For each iSCSI target, you need to specify a "scsi_id" value for each iSCSI target
Before:
`<`target iqn.2001-04.com.hostname-tgt-1`>`
direct-store /dev/disk/by-id/wwn-0x500258aaa
direct-store /dev/disk/by-id/wwn-0x500258aab
direct-store /dev/disk/by-id/wwn-0x500258aac
direct-store /dev/disk/by-id/wwn-0x500258aad
initiator-address 10.10.10.21
initiator-address 10.10.10.22
initiator-address 10.10.10.23
initiator-address 10.10.10.24
initiator-address 10.10.10.25
initiator-address 10.10.10.26
`<`/target`>`
After:
`<`target iqn.2001-04.com.hostname-tgt-1:target-001`>`
scsi_id 500258aaa
direct-store /dev/disk/by-id/wwn-0x500258aaa
initiator-address 10.10.10.21
initiator-address 10.10.10.22
initiator-address 10.10.10.23
initiator-address 10.10.10.24
initiator-address 10.10.10.25
initiator-address 10.10.10.26
`<`/target`>`
`<`target iqn.2001-04.com.hostname-tgt-1:target-002`>`
scsi_id 500258aab
direct-store /dev/disk/by-id/wwn-0x500258aab
initiator-address 10.10.10.21
initiator-address 10.10.10.22
initiator-address 10.10.10.23
initiator-address 10.10.10.24
initiator-address 10.10.10.25
initiator-address 10.10.10.26
`<`/target`>`
`<`target iqn.2001-04.com.hostname-tgt-1:target-003`>`
scsi_id 500258aac
direct-store /dev/disk/by-id/wwn-0x500258aac
initiator-address 10.10.10.21
initiator-address 10.10.10.22
initiator-address 10.10.10.23
initiator-address 10.10.10.24
initiator-address 10.10.10.25
initiator-address 10.10.10.26
`<`/target`>`
`<`target iqn.2001-04.com.hostname-tgt-1:target-004`>`
scsi_id 500258aad
direct-store /dev/disk/by-id/wwn-0x500258aad
initiator-address 10.10.10.21
initiator-address 10.10.10.22
initiator-address 10.10.10.23
initiator-address 10.10.10.24
initiator-address 10.10.10.25
initiator-address 10.10.10.26
`<`/target`>`
When you mount the iSCSI targets from both iSCSI servers, the symlinks under /dev/disk/by-id will be unique for every iSCSI target.
NOTE: I used backticks ("`") in front of the < or > characters because this website's editor was not displaying them correctly. Don't use backticks when you edit your 1.tgt file.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
