Disk /dev/sdd: 8589 MB, 8589934592 bytes, 16777216 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x6a5f4f5f
Disk /dev/sde: 8589 MB, 8589934592 bytes, 16777216 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x6a5f4f5f
[root@lilo-san ~]# lsblk |egrep "sdc|sdd|sde" sdc 8:32 0 2G 0 disk sdd 8:48 0 8G 0 disk sde 8:64 0 8G 0 disk
sdc, sdd, sde라는 디스크를 공유할 예정입니다.
iSCSI Target 데몬과 관련된 패키지를 설치하고 데몬을 Enable하고 활성화합니다.
▶ targetcli 설치 [root@lilo-san ~]# yum install targetcli
▶target 데몬 enable 후 활성화 [root@lilo-san ~]# systemctl enable --now target Created symlink from /etc/systemd/system/multiuser.target.wants/target.service to /usr/lib/systemd/system/target.service.
▶target 데몬 상태 확인 [root@lilo-san ~]# systemctl is-active target active
"tagetcli" 명령을 이용해 IQN(iSCSI 고유의 이름), LUN, Portal 등을 생성합니다.
이 글에서는 명령어 위주로 진행하지만 "cd" 명령어를 이용해 블록을 옮길 수 있는 등 TUI 환경으로도 진행이 가능합니다. 중간 중간에 잘 생성 되었는지는 "ls 명령을 이용해 확인하면 됩니다.
먼저 사용할 backstores의 block을 생성합니다.
backstore는 iSCSI로 제공되는 스토리지를 설정하는 역할을 합니다. block은 제공할 블록단위 디바이스 혹은 파티셔닝한 디바이스입니다.
▶targetcli 진입 [root@lilo-san ~]# targetcli targetcli shell version 2.1.51 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'.
▶현황 확인 /> ls
▶iSCSI로 공유할 블록 생성 /> /backstores/block create LUN1 /dev/sdc Created block storage object LUN1 using /dev/sdc.
/> /backstores/block create LUN2 /dev/sdd Created block storage object LUN2 using /dev/sdd.
/> /backstores/block create LUN3 /dev/sde Created block storage object LUN3 using /dev/sde.
▶현황 확인 /> ls
IQN, LUN, ACL를 생성합니다.
TPG1은 생략해도 무관하기 때문에 뒤에 별도로 입력하지 않아도 무관합니다.
▶IQN 생성 /> /iscsi create iqn.2021-09.com.san.lilo:server1 Created target iqn.2021-09.com.san.lilo:server1. Created TPG 1. Global pref auto_add_default_portal=true Created default portal listening on all IPs (0.0.0.0), port 3260.
▶LUN 생성 /> /iscsi/iqn.2021-09.com.san.lilo:server1/tpg1/luns create /backstores/block/LUN1 Created LUN 0. /> /iscsi/iqn.2021-09.com.san.lilo:server1/tpg1/luns create /backstores/block/LUN2 Created LUN 1. /> /iscsi/iqn.2021-09.com.san.lilo:server1/tpg1/luns create /backstores/block/LUN3 Created LUN 2.