(1) 서버설정
1. targetcli 설치
serverX# yum -y install targetcli
2. target으로 사용할 LV생성, 디스크파티션생성 # vgcreate target_vg /dev/sdc2 # lvcreate -n target_lv -l +100%FREE target_vg # lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert target_lv target_vg -wi-a----- 1020.00m
- /dev/sde (디스크파티션 생성)
3. 보조스토리지 저장소(파일) 생성 # targetcli /> cd /backstores /backstores> fileio/ create file1 /root/disk1_file1 100M
4. 보조스토리지 저장소(block) 생성 # targetcli /> cd /backstores /backstores> block/ create block1 /dev/target_vg/target_lv Created block storage object block1 using /dev/target_vg/target_lv. /backstores> block/ create block2 /dev/sde Created block storage object block2 using /dev/sde.
/backstores> ls o- backstores ................................................................................................................ [...] o- block .................................................................................................... [Storage Objects: 2] | o- block1 ........................................................ [/dev/target_vg/target_lv (1020.0MiB) write-thru deactivated] | o- block2 ........................................................................... [/dev/sde (1.0GiB) write-thru deactivated] o- fileio ................................................................................................... [Storage Objects: 1] | o- file1 ................................................................... [/root/disk1_file1 (100.0MiB) write-back activated] o- pscsi .................................................................................................... [Storage Objects: 0] o- ramdisk .................................................................................................. [Storage Objects: 0]
5. 대상의 IQN 생성 /> cd /iscsi /iscsi> create iqn.2015-04.com.example:remotedisk1 Created target iqn.2015-04.com.example:remotedisk1. Created TPG 1.
6. TPG1에 대한 ACL생성
/iscsi> cd iqn.2015-04.com.example:remotedisk1/ /iscsi/iqn.20...e:remotedisk1> cd tpg1/ /iscsi/iqn.20...otedisk1/tpg1> acls/ create iqn.2015-04.com.example:desktopX Created Node ACL for iqn.2015-04.com.example:desktopx Created mapped LUN 0.
7. file1, block1,2 에대한 LUN생성 /iscsi/iqn.20...otedisk1/tpg1> luns/ create /backstores/fileio/file1 Created LUN 0. /iscsi/iqn.20...otedisk1/tpg1> luns/ create /backstores/block/block1 Created LUN 1. Created LUN 1->1 mapping in node ACL iqn.2015-04.com.example:desktopx /iscsi/iqn.20...otedisk1/tpg1> luns/ create /backstores/block/block2 Created LUN 2. Created LUN 2->2 mapping in node ACL iqn.2015-04.com.example:desktopx
8. Portal 생성 (서버의 if주소로 생성) /iscsi/iqn.20...otedisk1/tpg1> portals/ create 165.213.246.94 Using default IP port 3260 Created network portal 165.213.246.94:3260.
9. 전체 구성확인 /iscsi/iqn.20...otedisk1/tpg1> cd / /> ls o- / ......................................................................................................................... [...] o- backstores .............................................................................................................. [...] | o- block .................................................................................................. [Storage Objects: 2] | | o- block1 ........................................................ [/dev/target_vg/target_lv (1020.0MiB) write-thru activated] | | o- block2 ........................................................................... [/dev/sde (1.0GiB) write-thru activated] | o- fileio ................................................................................................. [Storage Objects: 1] | | o- file1 ................................................................. [/root/disk1_file1 (100.0MiB) write-back activated] | o- pscsi .................................................................................................. [Storage Objects: 0] | o- ramdisk ................................................................................................ [Storage Objects: 0] o- iscsi ............................................................................................................ [Targets: 1] | o- iqn.2015-04.com.example:remotedisk1 ............................................................................... [TPGs: 1] | o- tpg1 ............................................................................................... [no-gen-acls, no-auth] | o- acls .......................................................................................................... [ACLs: 1] | | o- iqn.2015-04.com.example:desktopx ..................................................................... [Mapped LUNs: 3] | | o- mapped_lun0 ................................................................................ [lun0 fileio/file1 (rw)] | | o- mapped_lun1 ................................................................................ [lun1 block/block1 (rw)] | | o- mapped_lun2 ................................................................................ [lun2 block/block2 (rw)] | o- luns .......................................................................................................... [LUNs: 3] | | o- lun0 ............................................................................... [fileio/file1 (/root/disk1_file1)] | | o- lun1 ........................................................................ [block/block1 (/dev/target_vg/target_lv)] | | o- lun2 ........................................................................................ [block/block2 (/dev/sde)] | o- portals .................................................................................................... [Portals: 1] | o- 165.213.246.94:3260 .............................................................................................. [OK] o- loopback ......................................................................................................... [Targets: 0]
/> exit Global pref auto_save_on_exit=true Last 10 configs saved in /etc/target/backup. Configuration saved to /etc/target/saveconfig.json
10. 방화벽 등록 및 재시작 # firewall-cmd --permanent --add-port=3260/tcp # firewall-cmd --reload # systemctl restart target.service
(2) 클라이언트 설정 1. iscsi-initiator-utils 설치
# yum -y install iscsi-initiator-utils
2. 클라이언트의 이니시에이터 네임설정 #vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2015-04.com.example:desktopX
3. iscsi 서비스 활성화 및 시작
# systemctl enable iscsi # systemctl start iscsi
4. 포털검색 # iscsiadm -m iscsiadm -m discovery -t sendtargets -p 165.213.246.94 165.213.246.94:3260,1 iqn.2015-04.com.example:remotedisk1
5. 포털 로그인 # iscsiadm -m iscsiadm -m node -T "iqn.2015-04.com.example:remotedisk1" -p 165.213.246.94:3260 -l Logging in to [iface: default, target: iqn.2015-04.com.example:remotedisk1, portal: 165.213.246.94,3260] (multiple) Login to [iface: default, target: iqn.2015-04.com.example:remotedisk1, portal: 165.213.246.94,3260] successful.
6. 디바이스 확인
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sda 8:0 0 40G 0 disk ├─sda1 8:1 0 500M 0 part /boot sdd 8:48 0 100M 0 disk
# iscsiadm -m session -P 3 ...
Attached scsi disk sdd State: running
7. 영구노드 레코드 확인
# cd /var/lib/iscsi/nodes/
#ls -Rl .: drw-------. 3 root root 34 4월 29 16:43 iqn.2015-04.com.example:remotedisk1
./iqn.2015-04.com.example:remotedisk1: drw-------. 2 root root 20 4월 29 16:43 165.213.246.94,3260,1
./iqn.2015-04.com.example:remotedisk1/165.213.246.94,3260,1: -rw-------. 1 root root 2049 4월 29 16:43 default
8. 매개변수 기본값 확인 # less iqn.2015-04.com.example\:remotedisk1/165.213.246.94\,3260\,1/default # BEGIN RECORD 6.2.0.873-21 node.name = iqn.2015-04.com.example:remotedisk1 node.tpgt = 1 node.startup = automatic node.leading_login = No ..........................
9. 연결끊기 # iscsiadm -m node -T "iqn.2015-04.com.example:remotedisk1" -p 165.213.246.94:3260 -u # iscsiadm -m node -T "iqn.2015-04.com.example:remotedisk1" -p 165.213.246.94:3260 -o delete (영구)
10. 노드 레코드 확인 # cd /var/lib/iscsi/nodes/
#ls -Rl
11. 디바이스 확인 # lsblk
|
댓글