서버구성
- 패키지 설치1
$ yum install -y scsi-target-utils libibverbs libibverbs-devel librdmacm librdmacm-devel - 데몬 실행 및 서비스 활성화 후 실행1
$ chkconfig tgtd on; /etc/init.d/tgtd start2$ chkconfig --list | grep tgtd3tgtd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- target이름 설정1
$ tgtadm --lld iscsi -o new -m target --tid 1 -T iqn.test.storage23#iqn.test.storage이 값은 임의 변경 가능하고, 물리적인 디스크와 직접 연결하는 부분이 아님 - target설정상태 확인1
$ tgtadm --lld iscsi -o show -m target23Target 1: iqn.test.storage4System information:5Driver: iscsi6State: ready7I_T nexus information:8LUN information:9LUN: 010Type: controller11SCSI ID: IET 0001000012SCSI SN: beaf1013Size: 0 MB, Block size: 114Online: Yes15Removable media: No16Readonly: No17Backing store type: null18Backing store path: None19Backing store flags:20Account information:21ACL information: - 설정한 target에 볼륨지정1
$ tgtadm --lld iscsi -o new -m logicalunit --tid 1 --lun 1 -b /dev/sda5 - 볼륨 등록 확인1
$ tgtadm --lld iscsi -o show -m target2Target 1: iqn.test.storage3System information:4Driver: iscsi5State: ready6I_T nexus information:7LUN information:8LUN: 09Type: controller10SCSI ID: IET 0001000011SCSI SN: beaf1012Size: 0 MB, Block size: 113Online: Yes14Removable media: No15Readonly: No16Backing store type: null17Backing store path: None18Backing store flags:19LUN: 120Type: disk21SCSI ID: IET 0001000122SCSI SN: beaf1123Size: 10619 MB, Block size: 51224Online: Yes25Removable media: No26Readonly: No27Backing store type: rdwr28Backing store path: /dev/sda529Backing store flags:30Account information:31ACL information: - target 접근 제한 적용1
$ tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address 192.168.100.10 - target에 계정등록1
$ tgtadm --lld iscsi --op new --mode account --user test --password iscsitest - 등록한 계정리스트 확인하기1
$ tgtadm --lld iscsi --op show --mode account2Account list:3test - 등록한 볼륨에 계정 연동하기1
$ tgtadm --lld iscsi --op bind --mode account --tid 1 --user test - 볼륨과 계정연동 확인1
$ tgtadm --lld iscsi --op show --mode target2Target 1: iqn.test.storage3System information:4Driver: iscsi5State: ready6I_T nexus information:7LUN information:8LUN: 09Type: controller10SCSI ID: IET 0001000011SCSI SN: beaf1012Size: 0 MB, Block size: 113Online: Yes14Removable media: No15Readonly: No16Backing store type: null17Backing store path: None18Backing store flags:19LUN: 120Type: disk21SCSI ID: IET 0001000122SCSI SN: beaf1123Size: 10619 MB, Block size: 51224Online: Yes25Removable media: No26Readonly: No27Backing store type: rdwr28Backing store path: /dev/sda529Backing store flags:30Account information:31test32ACL information:33192.168.100.10 - 등록한 target을 설정파일로 저장하기(기존파일은 백업 수행)1
$ mv /etc/tgt/targets.conf /etc/tgt/targets.conf_ori2$ tgt-admin --dump > /etc/tgt/targets.conf - 생성된 파일 정보 확인1
$ cat /etc/tgt/targets.conf23default-driver iscsi4<target iqn.test.storage>5backing-store /dev/sda56incominguser test iscsitest7# 패스워드 지정시, 12자~16자 위안에서 설정8initiator-address 192.168.100.109</target> - target 재시작1
$ /etc/init.d/tgtd restart2Stopping SCSI target daemon: Stopping target framework daemon3[ OK ]4Starting SCSI target daemon: Starting target framework daemon
클라이언트 설정
- 패키지 설치1
$ yum install -y iscsi-initiator-utils - 서비스 활성화 후 실행1
$ /etc/init.d/iscsi start2$ /etc/init.d/iscsid start3$ chkconfig iscsi on; chkconfig iscsid on;• - target에서 지정한 인증정보 적용하기1
$vi /etc/iscsi/iscsid.conf2#node.session.auth.username = username3#node.session.auth.password = password4#discovery.sendtargets.auth.username = username5#discovery.sendtargets.auth.password = password6# 4군데 주석풀고 지정한 계정입력 - iscsid 서비스 재시작1
$ /etc/init.d/iscsid restart2Stopping iSCSI daemon: [ OK ]3Starting iSCSI daemon: [ OK ] - target 정보 확인1
$ iscsiadm --mode discovery --type sendtargets --portal 192.168.10.10 (target서버ip)2#192.168.10.10:3260,1 iqn.test.storage (정상적일 경우, 해당 정보가 출력되며, 기타 문제가 발생할 경우 "iscsiadm: No portals found" 메시지를 뿌린다. - target 서버 연결1
$ iscsiadm --mode node --targetname iqn.test.storage --portal 192.168.10.10 -l -n node.startup -v automatic - 디스크 연결정보 확인1
$ fdisk -l2Disk /dev/sda: 21.4 GB, 21474836480 bytes3255 heads, 63 sectors/track, 2610 cylinders4Units = cylinders of 16065 * 512 = 8225280 bytes56Device Boot Start End Blocks Id System7/dev/sda1 * 1 13 104391 83 Linux8/dev/sda2 14 1057 8385930 83 Linux9/dev/sda3 1058 1452 3172837+ 82 Linux swap / Slaris10/dev/sda4 1453 2610 9301635 5 Extended11/dev/sda5 1453 2610 9301603+ 83 Linux121314Disk /dev/sdb: 10.6 GB, 10618804224 bytes1564 heads, 32 sectors/track, 10126 cylinders16Units = cylinders of 2048 * 512 = 1048576 bytes1718Disk /dev/sdb doesn't contain a valid partition table
# 기존에 없던 /dev/sdb 장비 출력확인 되었으면, /dev/sdb장치 파티션 구성하여 사용하면 됨. - 부팅후 활성화를 위해 적용1
$ vi /etc/fstab2...3/dev/sdb1 /data ext3 _netdev 0 0
클라이언트와 서버 구성 작업
- iscsi 사용 중단1
$ iscsiadm -m node -T iqn.test.storage -p 192.168.10.10 -u2Logging out of session [sid: 1, target: iqn.test.storage, portal: 192.168.10.10,3260]34Logout of [sid: 1, target: iqn.test.storage, portal: 192.168.10.10,3260] successful. - 영구적 연결 해제1
$ iscsiadm -m node -T iqn.test.storage -p 192.168.10.10 -o delete - target에 연결세션 확인1
$ tgtadm --lld iscsi --op show --mode session --tid 1 --sid 1
댓글 없음:
댓글 쓰기