This shows you the differences between two versions of the page.
saisp:labs:06:contents:05 [2014/03/29 23:05] mihai.carabas [05. LIO backstore as a physical block device] |
saisp:labs:06:contents:05 [2016/04/11 21:12] (current) alexandru.carp [05. [10p] Restricționarea accesului la dispozitivile logice (LUN)] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 05. LIO backstore as a physical block device ==== | + | ==== 05. [10p] Restricționarea accesului la dispozitivile logice (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. | + | Vom mai crea un nou ''LUN'' ce are ca ''backstore'' tot un fișier:<code bash> |
+ | /backstores/fileio> create disk2 /disk2.img 100M | ||
+ | Generating a wwn serial. | ||
+ | Not using buffered mode. | ||
+ | Created fileio disk2. | ||
+ | /backstores/fileio> cd /iscsi/iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d/tpgt1/luns/ | ||
+ | /iscsi/iqn.20...4d/tpgt1/luns> | ||
+ | </code> | ||
- | <solution -hidden> | + | Vom mai crea încă un ''LUN'' asociat backstore-ului ''disk2.img'':<code bash> |
- | <code> | + | /iscsi/iqn.20...4d/tpgt1/luns> create /backstores/fileio/disk2 1 |
- | root@storage1:~# targetcli | + | |
- | /> cd backstores/iblock | + | |
- | /backstores/iblock> create sdb /dev/sdb | + | |
- | Generating a wwn serial. | + | |
- | Created iblock storage object sdb using /dev/sdb. | + | |
- | /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 | + | |
Successfully created LUN 1. | Successfully created LUN 1. | ||
Created mapped LUN 1 in node ACL iqn.2005-03.org.open-iscsi:fc35d7d3fc24 | Created mapped LUN 1 in node ACL iqn.2005-03.org.open-iscsi:fc35d7d3fc24 | ||
- | /> saveconfig | ||
- | WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | ||
- | The current target configuration will become the default boot config. | ||
- | Are you sure? Type 'yes': yes | ||
- | |||
- | |||
- | root@storage3:~# apt-get install open-iscsi | ||
- | root@storage3:~# iscsi-iname | ||
- | iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
- | root@storage3:~# cat /etc/iscsi/initiatorname.iscsi | ||
- | InitiatorName=iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
- | |||
- | /> cd /iscsi/iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d/tpgt1/acls/ | ||
- | /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 | ||
- | Created mapped LUN 1. | ||
- | Created mapped LUN 0. | ||
- | /> saveconfig | ||
- | WARNING: Saving storage1 current configuration to disk will overwrite your boot settings. | ||
- | The current target configuration will become the default boot config. | ||
- | Are you sure? Type 'yes': yes | ||
- | |||
- | 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 | ||
- | |||
- | 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) | ||
- | Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d, portal: 192.168.1.1,3260] successful. | ||
- | |||
- | 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) | ||
- | |||
- | root@storage3:~# iscsiadm -m session -P 1 | ||
- | Target: iqn.2003-01.org.linux-iscsi.storage1.x8664:sn.25e09e86bb4d (non-flash) | ||
- | Current Portal: 192.168.1.1:3260,1 | ||
- | Persistent Portal: 192.168.1.1:3260,1 | ||
- | ********** | ||
- | Interface: | ||
- | ********** | ||
- | Iface Name: default | ||
- | Iface Transport: tcp | ||
- | Iface Initiatorname: iqn.2005-03.org.open-iscsi:8ceabce62de9 | ||
- | Iface IPaddress: 192.168.1.3 | ||
- | 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> | + | Observați că în mod implicit acesta s-a adăugat automat pentru clientul ''storage2'' (la IQN-ul acestuia). Dorim să scoatem această mapare:<code bash> |
- | + | /iscsi/iqn.20...4d/tpgt1/luns> cd ../acls/iqn.2005-03.org.open-iscsi:fc35d7d3fc24 | |
+ | /iscsi/iqn.20...:fc35d7d3fc24> ls | ||
+ | o- iqn.2005-03.org.open-iscsi:fc35d7d3fc24 ........................................... [2 Mapped LUNs] | ||
+ | o- mapped_lun0 ......................................................................... [lun0 (rw)] | ||
+ | o- mapped_lun1 ......................................................................... [lun1 (rw)] | ||
+ | /iscsi/iqn.20...:fc35d7d3fc24> delete 1 | ||
+ | Deleted Mapped LUN 1. | ||
+ | </code> |