This shows you the differences between two versions of the page.
|
saisp:labs:06:contents:06 [2014/03/29 23:16] mihai.carabas [06. Restricționarea accesului la dispozitivile logice (LUN)] |
saisp:labs:06:contents:06 [2014/03/30 00:26] (current) mihai.carabas [06. LIO backstore as a physical block device] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== 06. LIO backstore as a physical block device ==== | + | ==== 06. [20p] LIO backstore as a physical block device ==== |
| Creați un ''backstore'' de tip physical device (Hint: ''iblock'') folosind discul ''/dev/sdb'' de pe stația ''storage1''. Asociați ''backstore''-ul creat cu un LUN și montați-l pe stația ''storage3''. Nu uitați să mapați IQN-ul stației ''storage3'' la noul LUN. | Creați un ''backstore'' de tip physical device (Hint: ''iblock'') folosind discul ''/dev/sdb'' de pe stația ''storage1''. Asociați ''backstore''-ul creat cu un LUN și montați-l pe stația ''storage3''. Nu uitați să mapați IQN-ul stației ''storage3'' la noul LUN. | ||
| - | <note warning>Implicit, clientul creat de voi va avea acces la ambele LUN-uri si vor apărea ca /dev/sdd și /dev/sd3. Voi lucrați doar pe /dev/sde.</note> | + | <note warning>Implicit, clientul creat de voi va avea acces la toate LUN-urile. Permiteți accesul doar pentru ''LUN 2''. Eliminați de asemenea ''LUN 2'' de la IQN-ul stației ''storage2''.</note> |
| <solution -hidden> | <solution -hidden> | ||
| - | <code> | + | <code bash> |
| root@storage1:~# targetcli | root@storage1:~# targetcli | ||
| /> cd backstores/iblock | /> cd backstores/iblock | ||
| Line 13: | Line 13: | ||
| Created iblock storage object sdb using /dev/sdb. | Created iblock storage object sdb using /dev/sdb. | ||
| /backstores/iblock> cd /iscsi/iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d/tpgt1/luns/ | /backstores/iblock> cd /iscsi/iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d/tpgt1/luns/ | ||
| - | /iscsi/iqn.20...4d/tpgt1/luns> create /backstores/iblock/sdb lun1 | + | /iscsi/iqn.20...4d/tpgt1/luns> create /backstores/iblock/sdb lun2 |
| - | Successfully created LUN 1. | + | Successfully created LUN 2. |
| - | Created mapped LUN 1 in node ACL iqn.2005-03.org.open-iscsi:fc35d7d3fc24 | + | Created mapped LUN 2 in node ACL iqn.2005-03.org.open-iscsi:fc35d7d3fc24 |
| /> saveconfig | /> saveconfig | ||
| WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | ||
| Line 31: | Line 31: | ||
| /iscsi/iqn.20...4d/tpgt1/acls> create iqn.2005-03.org.open-iscsi:8ceabce62de9 | /iscsi/iqn.20...4d/tpgt1/acls> create iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
| Successfully created Node ACL for iqn.2005-03.org.open-iscsi:8ceabce62de9 | Successfully created Node ACL for iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
| + | Created mapped LUN 2. | ||
| Created mapped LUN 1. | Created mapped LUN 1. | ||
| Created mapped LUN 0. | Created mapped LUN 0. | ||
| + | /iscsi/iqn.20...4d/tpgt1/acls> cd iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
| + | /iscsi/iqn.20...:8ceabce62de9> delete 0 | ||
| + | Deleted Mapped LUN 0. | ||
| + | /iscsi/iqn.20...:8ceabce62de9> delete 1 | ||
| + | Deleted Mapped LUN 1. | ||
| /> saveconfig | /> saveconfig | ||
| WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | ||
| Line 40: | Line 46: | ||
| root@storage3:~# iscsiadm --mode discovery --type st --portal 192.168.1.1 | root@storage3:~# iscsiadm --mode discovery --type st --portal 192.168.1.1 | ||
| 192.168.1.1:3260,1 iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d | 192.168.1.1:3260,1 iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d | ||
| - | |||
| root@storage3:~# iscsiadm -m node -L all | root@storage3:~# iscsiadm -m node -L all | ||
| Logging in to [iface: default, target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d, portal: 192.168.1.1,3260] (multiple) | Logging in to [iface: default, target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d, portal: 192.168.1.1,3260] (multiple) | ||
| Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d, portal: 192.168.1.1,3260] successful. | Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d, portal: 192.168.1.1,3260] successful. | ||
| + | root | ||
| root@storage3:~# iscsiadm -m session | root@storage3:~# iscsiadm -m session | ||
| tcp: [1] 192.168.1.1:3260,1 iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d (non-flash) | tcp: [1] 192.168.1.1:3260,1 iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d (non-flash) | ||
| - | root@storage3:~# iscsiadm -m session -P 1 | + | root@storage3:~# dmesg |tail -10 |
| - | Target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d (non-flash) | + | [24607.849541] scsi3 : iSCSI Initiator over TCP/IP |
| - | Current Portal: 192.168.1.1:3260,1 | + | [24608.105052] scsi 3:0:0:2: Direct-Access LIO-ORG IBLOCK 4.0 PQ: 0 ANSI: 5 |
| - | Persistent Portal: 192.168.1.1:3260,1 | + | [24608.105819] sd 3:0:0:2: Attached scsi generic sg3 type 0 |
| - | ********** | + | [24608.107245] sd 3:0:0:2: [sdd] 204800 512-byte logical blocks: (104 MB/100 MiB) |
| - | Interface: | + | [24608.110439] sd 3:0:0:2: [sdd] Write Protect is off |
| - | ********** | + | [24608.110442] sd 3:0:0:2: [sdd] Mode Sense: 43 00 00 08 |
| - | Iface Name: default | + | [24608.111382] sd 3:0:0:2: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA |
| - | Iface Transport: tcp | + | [24608.120119] sdd: unknown partition table |
| - | Iface Initiatorname: iqn.2005-03.org.open-iscsi:8ceabce62de9 | + | [24608.124463] sd 3:0:0:2: [sdd] Attached SCSI disk |
| - | Iface IPaddress: 192.168.1.3 | + | [24615.904190] nfs: server storage1 not responding, timed out |
| - | Iface HWaddress: <empty> | + | |
| - | Iface Netdev: <empty> | + | |
| - | SID: 1 | + | |
| - | iSCSI Connection State: LOGGED IN | + | |
| - | iSCSI Session State: LOGGED_IN | + | |
| - | Internal iscsid Session State: NO CHANGE | + | |
| - | | + | |
| </code> | </code> | ||
| </solution> | </solution> | ||