Lun(iSCSI) setup with Linux example
1. Test 환경
OS Lun size software License IP
Server Centos 5.4 - iSCSI initiator - 220.117.55.226
Storage DataOntap 7.3.2 1g - iSCSI 220.117.55.225
2. iscsi initiator 설치 (server)
1) yum이 가능한 경우 yum으로 설치
# yum list iscsi*
# yum install iscsi-initiator*
2) rpm 사용시(패키지는 OS씨디에 있음)
# rpm -qa | grep iscsi*
# rpm –Uvh --aid iscsi-initiator-utils*
2. Host Utility 설치 (server)
-> version 5.0
# tar -xvf netapp_linux_host_utilities_5_0.tar.gz
# cd netapp_linux_host_utilities_5_0
# ./install
3. IQN 확인 (server)
# iscsiadm -m discovery -t sendtargets -p 220.117.55.225
220.117.55.225:3260,1000 iqn.1992-08.com.netapp:sn.84203700
-> Storage IQN
# more /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:5c4516d4863c
-> Server IQN
4. igroup 생성 및 lun 생성(storage)
> igroup create -i -t linux linux_ig iqn.1994-05.com.redhat:5c4516d4863c
> lun create -s 1g -t linux -o noreserve /vol/iscsi/linux/lun.0
> lun map /vol/iscsi/linux/lun.0 linux_ig 0
5. Lun discover(server)
# service iscsi start
# iscsiadm -m node -T iqn.1992-08.com.netapp:sn.84203700 -p 220.117.55.225 -l
# iscsiadm -m session rescan
6. Lun 확인 및 format(server)
# fdisk -l
# /opt/netapp/santools/sanlun lun show
[root@netapp ~]# /opt/netapp/santools/sanlun lun show
controller: lun-pathname device filename adapter protocol lun size lun state
F270: /vol/iscsi/linux/lun.0 /dev/sdb host2 iSCSI 1g (1073741824) GOOD
# fdisk /dev/sdb
[root@netapp santools]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1011, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011):
Using default value 1011
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1011 1048376+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs.ext3 /dev/sdb1
[root@netapp ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262094 blocks
13104 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
7. 부팅시 iscsi 서비스 시작(server)
# chkconfig --add iscsi
# chkconfig --list iscsi