RHEL7 iSCSI 구성하기
패키지 설치
iSCSI Target을 구성하기 위해서는 아래의 패키지가 필요하다
[user@host]# yum install targetcli [user@host]# systemctl enable target [user@host]# systemctl start target
BackStore 구성
Backstore는 iSCSI에서 저장공간을 의미한다. 즉 해당 iscsi target의 저장영역을 어떤것으로 구성할지를 설정하게 되는데 backstore를 구성하는 방법은 4가지가 존재한다.
FILEIO: FILE을 저장영역으로 사용BLOCK: 실제 블럭 디바이스를 저장영역으로 사용PSCSI: 실제 SCSI디바이스를 저장영역으로 사용Memory Copy RAM disk (Linux RAMDISK_MCP): 메모리를 저장영역으로 사용
''PSCSI''는 ''Pass-through SCSI''형태로서 실제 SCSI 디바이스를 직접 제공하므로 ''ALUA''같은 기능을 사용할 수 있지만 VMWARE ESXi같은 일부 환경에서는 정상적으로 작동하지 않을수도 있으므로 이런경우 BLOCK 형태로 구성하는것이 좋다.
iSCSI Target 설정하기
[root@storage ~]# targetcli Warning: Could not load preferences file /root/.targetcli/prefs.bin. targetcli shell version 2.1.fb41 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'. /> iscsi/ /iscsi> create Created target iqn.2003-01.org.linux-iscsi.storage.x8664:sn.2c54b81ee88a. Created TPG 1. Global pref auto_add_default_portal=true Created default portal listening on all IPs (0.0.0.0), port 3260. /iscsi>
create 명령어만으로 자동으로 IQN이 생성되지만 수동으로 IQN을 직접 지정해줄수도 있다.
/iscsi> create iqn.2006-04.com.example:444 Created target iqn.2006-04.com.example:444 Created TPG1
ls 명령어를 입력하면 생성된 iscsi target을 확인할 수 있다.
/iscsi> ls
o- iscsi .................................................................. [Targets: 1]
o- iqn.2003-01.org.linux-iscsi.storage.x8664:sn.2c54b81ee88a ............... [TPGs: 1]
o- tpg1 ..................................................... [no-gen-acls, no-auth]
o- acls ................................................................ [ACLs: 0]
o- luns ................................................................ [LUNs: 0]
o- portals .......................................................... [Portals: 1]
o- 0.0.0.0:3260 ........................................................... [OK]
/iscsi>
인증 비활성화
기본적으로 ACL이 적용된 상태인데 이것을 인증없이 자유롭게 이용할수 있도록 하는 설정이다.
# disable authentication /iscsi/iqn.20...1:server/tpg1> set attribute authentication=0 Parameter authentication is now '0'. # "ignore ACLs mode" /iscsi/iqn.20...1:server/tpg1> set attribute generate_node_acls=1 Parameter generate_node_acls is now '1'. # enable read/write mode /iscsi/iqn.20...1:server/tpg1> set attribute demo_mode_write_protect=0 Parameter demo_mode_write_protect is now '0'.
저장 및 확인
/> saveconfig Last 10 configs saved in /etc/target/backup/. Configuration saved to /etc/target/saveconfig.json /> exit Global pref auto_save_on_exit=true Last 10 configs saved in /etc/target/backup/. Configuration saved to /etc/target/saveconfig.json
클라이언트에서 확인 방법
# 패키지 설치 [root@rhcs8-1 ~]# dnf -y install iscsi-initiator-utils # 타겟 확인 [root@rhcs8-1 ~]# iscsiadm -m discovery -t st -p 10.33.0.89 10.33.0.89:3260,1 iqn.2003-01.org.linux-iscsi.rhcs8-storage.x8664:sn.ae8026b2e597