1. 1GB 새로운 파티션 생성
server11# fdisk /dev/vdb
n => p => Enter => Enter => +1G => w
n => p => Enter => Enter => +1G => t => 8e => w // LVM
// LVM 사용 시 pvcreate /dev/vdb1, vgcreate iSCSI_vg /dev/vdb1, lvcreate -n disk1_lv -L 100m iSCSI_vg
2. targetcli 패키지 설치
server11# yum install targetcli
3. target.service 활성화 및 시작
server11# systemctl enable target.service
ln -s '/usr/lib/systemd/system/target.service' '/etc/systemd/system/multi-user.target.wants/target.service'
server11# systemctl start target.service
server11# targetcli
### 블록 생성
/> /backstores/block create disk1 /dev/vdb1
Created block storage object disk1 using /dev/vdb1.
### TARGET 생성
/> /iscsi create iqn.2015-03.com.example:server11
Created target iqn.2015-03.com.example:server11.
Created TPG 1.
### ACL 생성
/> /iscsi/iqn.2015-03.com.example:server11/tpg1/acls create iqn.2015-03.com.example:desktop11
Created Node ACL for iqn.2015-03.com.example:desktop11
### LUN 생성
/> /iscsi/iqn.2015-03.com.example:server11/tpg1/luns create /backstores/block/disk1
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2015-03.com.example:desktop11
### portal 생성(타겟 서버의 IP이며 포탈처럼 열어주라는 의미)
/> /iscsi/iqn.2015-03.com.example:server11/tpg1/portals create 172.25.11.11 3260
Using default IP port 3260
Created network portal 172.25.11.11:3260.
/> saveconfig
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
/> exit
server11# firewall-cmd --permanent --add-port=3260/tcp
server11# firewall-cmd --add-port=3260/tcp
server11# firewall-cmd --reload
desktop11# yum install iscsi-initiator-utils
desktop11# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-03.com.example:desktop11
desktop11# systemctl restart iscsi
### 대상 검색
desktop11# iscsiadm -m discovery -t st -p server11.example.com
172.25.11.11:3260,1 iqn.2015-03.com.example:server11
### 로그인
desktop11# iscsiadm -m node -T iqn.2015-03.com.example:server11 -l
Logging in to [iface: default, target: iqn.2015-03.com.example:server11, portal: 172.25.11.11,3260] (multiple)
Login to [iface: default, target: iqn.2015-03.com.example:server11, portal: 172.25.11.11,3260] successful.
### iSCSI 디스크의 장치 노드 확인
desktop11# iscsiadm -m session -P3 | grep Attached
Attached SCSI devices:
Attached scsi disk sda State: running
### 파일시스템 포맷 및 UUID 확인
[root@desktop11 ~]# mkfs -t xfs /dev/sda
/dev/sda: UUID="d5199a71-863a-4814-9b9c-7856a8c00776" TYPE="xfs"
### fstab 등록
desktop11# vi /etc/fstab
UUID="d5199a71-863a-4814-9b9c-7856a8c00776" /iscsidisk xfs defaults 0 2
### mount
desktop11# mkdir /iscsidisk
desktop11# mount /iscsidisk
'Linux > CentOS' 카테고리의 다른 글
[CentOS7] Network Teaming (0) | 2015.03.17 |
---|---|
[CentOS7] NFS (0) | 2015.03.17 |
[CentOS7] 네트워킹 관리 (0) | 2015.03.16 |
[CentOS7] 서비스 및 데몬 제어 (0) | 2015.03.16 |
[CentOS5] GeoIP 커널 모듈 빌드 하는 방법 (0) | 2015.02.24 |
최근댓글