root@ubuntu:~# more /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
먼저, iSCSI initiator 설치
root@ubuntu:~# sudo apt-get install open-iscsi
root@ubuntu:~# dpkg -l |grep iscsi
ii open-iscsi 2.0.873+git0.3b4b4500-14ubuntu3.3 amd64 iSCSI initiator tools
initiator 가 설치되면 다음과 같이 디렉토리에서 iqn 정보 확인 가능
root@ubuntu:/etc/iscsi# pwd
/etc/iscsi
root@ubuntu:/etc/iscsi# ls -al
total 32
drwxr-xr-x 4 root root 4096 Nov 19 17:27 .
drwxr-xr-x 89 root root 4096 Nov 19 17:06 ..
-rw------- 1 root root 349 Nov 7 21:03 initiatorname.iscsi
-rw------- 1 root root 11788 Nov 19 17:27 iscsid.conf
drw------- 4 root root 4096 Nov 19 17:32 nodes
drw------- 4 root root 4096 Nov 8 16:12 send_targets
root@ubuntu:/etc/iscsi# more initiatorname.iscsi
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
InitiatorName=iqn.1993-08.org.debian:01:aeff61f6e0e3
iscsid.conf 파일을 다음과 같이 수정
이제 스토리지(Storwize IBM V7000)에서 iSCSI 환경 설정, 볼륨 생성 및 해당 서버에 볼륨 할당
iSCSI 볼륨을 사용하기 위해서는 네트워크 - 이더넷 포트 메뉴에서 IP 설정을 해주어야 한다. 당연히 V7000 GUI 접속을 위한 management IP 와는 다른 IP를 설정하는데 UTP 케이블은 물리적으로 동일한 port 를 사용한다.
스토리지에서 호스트 생성시 서버의 iqn 정보를 입력하고 생성한다.
스토리지 볼륨(50GB) 생성된 호스트에 할당
이제 다시 서버에서 스토리지 정보 인식. 스토리지에서 설정한 iSCSI 용 IP 입력
root@ubuntu:~# iscsiadm -m discovery -t st -p 9.187.227.230
9.187.227.230:3260,1 iqn.1986-03.com.ibm:2145.stg-v7000.node1
root@ubuntu:~# iscsiadm -m discovery -t st -p 9.187.227.240
9.187.227.240:3260,1 iqn.1986-03.com.ibm:2145.stg-v7000.node2
스토리지 연결. 다음과 같이 successful 이 나오면 성공
root@ubuntu:~# iscsiadm -m node --login
Logging in to [iface: default, target: iqn.1986-03.com.ibm:2145.stg-v7000.node2, portal: 9.187.227.240,3260] (multiple)
Logging in to [iface: default, target: iqn.1986-03.com.ibm:2145.stg-v7000.node1, portal: 9.187.227.230,3260] (multiple)
Login to [iface: default, target: iqn.1986-03.com.ibm:2145.stg-v7000.node2, portal: 9.187.227.240,3260] successful.
Login to [iface: default, target: iqn.1986-03.com.ibm:2145.stg-v7000.node1, portal: 9.187.227.230,3260] successful.
그리고, dmesg 로 연결된 스토리지 볼륨 확인
root@ubuntu:~# dmesg | tail -100 | grep sd
[ 5.273551] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ 7.079363] Adding 4191228k swap on /dev/sda5. Priority:-1 extents:1 across:4191228k FS
[597769.393140] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 39s! [vmtoolsd:985]
[597769.569910] CPU: 0 PID: 985 Comm: vmtoolsd Not tainted 4.4.0-62-generic #83-Ubuntu
[953286.712454] sd 4:0:0:0: [sdb] 104857600 512-byte logical blocks: (53.7 GB/50.0 GiB)
[953286.732047] sd 4:0:0:0: [sdb] Write Protect is off
[953286.732051] sd 4:0:0:0: [sdb] Mode Sense: 97 00 10 08
[953286.738440] sd 4:0:0:0: [sdb] Write cache: disabled, read cache: enabled, supports DPO and FUA
[953286.738663] sd 3:0:0:0: [sdc] 104857600 512-byte logical blocks: (53.7 GB/50.0 GiB)
[953286.746023] sd 3:0:0:0: [sdc] Write Protect is off
[953286.746027] sd 3:0:0:0: [sdc] Mode Sense: 97 00 10 08
[953286.746522] sd 3:0:0:0: [sdc] Write cache: disabled, read cache: enabled, supports DPO and FUA
[953286.808293] sd 3:0:0:0: Attached scsi generic sg2 type 0
[953286.808727] sd 4:0:0:0: Attached scsi generic sg3 type 0
[953286.857392] sd 3:0:0:0: [sdc] Attached SCSI disk
[953286.857563] sd 4:0:0:0: [sdb] Attached SCSI disk
스토리지의 컨트롤러가 2개이여서 sdb, sdc 로 볼륨 확인.
이제 multipath 구성을 위해 multipath-tool package 설치
root@ubuntu:~# apt-get install multipath-tools
설치후 다음과 같이 스토리지 볼륨을 확인 할 수 있으나,
root@ubuntu:~# multipath -ll
36005076802820c032000000000000055 dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| `- 3:0:0:0 sdc 8:32 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
`- 4:0:0:0 sdb 8:16 active ready running
/etc/multipath.conf 파일을 수정하여 볼륨을 alias 정의 후 사용. 기본적으로 multipath.conf 을 없으니 vi 로 파일 생성 후 다음과 같이 수정.
multipaths {
multipath {
wwid 36005076802820c032000000000000055
alias vol01
path_grouping_policy multibus
path_selector "round-robin 0"
failback manual
rr_weight priorities
no_path_retry 5
}
}
multipath 의 자세한 내용은 다음 링크 또는 각 스토리지 벤더에서 제공하는 방법을 참고.
https://help.ubuntu.com/lts/serverguide/multipath-dm-multipath-config-file.html
root@ubuntu:~# service multipathd restart
root@ubuntu:~# multipath -ll
vol01 (36005076802820c032000000000000055) dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=30 status=active
|- 3:0:0:0 sdc 8:32 active ready running
`- 4:0:0:0 sdb 8:16 active ready running
생성된 볼륨 포멧 및 마운트
root@ubuntu:~# fdisk -l |grep -i vol01
Disk /dev/mapper/vol01: 50 GiB, 53687091200 bytes, 104857600 sectors
root@ubuntu:~# mkfs.ext4 /dev/mapper/vol01
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 13107200 4k blocks and 3276800 inodes
Filesystem UUID: 3a2d7e7d-580a-4fd1-baaf-66bdb688ecb0
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
root@ubuntu:~# mount /dev/mapper/vol01 /data/
root@ubuntu:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 5.8M 390M 2% /run
/dev/sda1 26G 2.0G 23G 9% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 396M 0 396M 0% /run/user/1000
/dev/mapper/vol01 50G 52M 47G 1% /data
댓글 없음:
댓글 쓰기