Thursday, March 24, 2011

Cara Koneksi Linux CentOS ke Storage Area Network via iSCSI




Sebelumnya saya sudah pernah mengulas sedikit mengenai mengenai Network Area Storage (NAS). Saat ini saya akan mengulas bagaimana caranya untuk membuat koneksi dari Linux Centos ke SAN (Storage Area Network) yang ada melalui iscsi.

Kebutuhan akan NAS (Network Area Storage) maupun SAN (Storage Area Network) saat ini pastinya menjadi keharusan didalam suatu perusahaan yang sudah menerapkan infrastruktur IT di midle level. Pastinya server-server yang ada akan terhubung dengan Storage Server tersebut.

Untuk membuat koneksi dari Linux (khususnya centos yang saya pakai) ke SAN Storage tersebut dapat dilakukan dengan mengikuti langkah-langkah berikut :

1. Install terlebih dahulu open-iscsi nya :

[root@localhost ~]# yum install iscsi-initiator-utils.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.averse.net
* base: mirror.averse.net
* extras: mirror.averse.net
* updates: mirror.averse.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.x86_64 0:6.2.0.871-0.20.el5_5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
Package Arch Version Repository Size
=========================================================================================
Installing:
iscsi-initiator-utils x86_64 6.2.0.871-0.20.el5_5 updates 814 k

Transaction Summary
==========================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 814 k
Is this ok [y/N]: y
Downloading Packages:
iscsi-initiator-utils-6.2.0.871-0.20.el5_5.x86_64.rpm | 814 kB 00:05
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : iscsi-initiator-utils 1/1

Installed:
iscsi-initiator-utils.x86_64 0:6.2.0.871-0.20.el5_5

Complete!
[root@localhost ~]#


[root@localhost ~]# yum install scsi-target-utils.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.averse.net
* base: mirror.averse.net
* extras: mirror.averse.net
* updates: mirror.averse.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package scsi-target-utils.x86_64 0:0.0-6.20091205snap.el5_5.3 set to be updated
--> Processing Dependency: perl(Config::General) for package: scsi-target-utils
--> Processing Dependency: libibverbs.so.1()(64bit) for package: scsi-target-utils
--> Processing Dependency: librdmacm.so.1()(64bit) for package: scsi-target-utils
--> Running transaction check
---> Package libibverbs.x86_64 0:1.1.3-2.el5 set to be updated
--> Processing Dependency: openib >= 1.0 for package: libibverbs
---> Package librdmacm.x86_64 0:1.0.10-1.el5 set to be updated
---> Package perl-Config-General.noarch 0:2.40-1.el5 set to be updated
--> Running transaction check
---> Package openib.noarch 0:1.4.1-5.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
scsi-target-utils x86_64 0.0-6.20091205snap.el5_5.3 updates 143 k
Installing for dependencies:
libibverbs x86_64 1.1.3-2.el5 base 44 k
librdmacm x86_64 1.0.10-1.el5 base 23 k
openib noarch 1.4.1-5.el5 base 20 k
perl-Config-General noarch 2.40-1.el5 base 68 k

Transaction Summary
=======================================================================================
Install 5 Package(s)
Upgrade 0 Package(s)

Total download size: 299 k
Is this ok [y/N]: y
Downloading Packages:
(1/5): openib-1.4.1-5.el5.noarch.rpm | 20 kB 00:00
(2/5): librdmacm-1.0.10-1.el5.x86_64.rpm | 23 kB 00:00
(3/5): libibverbs-1.1.3-2.el5.x86_64.rpm | 44 kB 00:00
(4/5): perl-Config-General-2.40-1.el5.noarch.rpm | 68 kB 00:00
(5/5): scsi-target-utils-0.0-6.20091205snap.el5_5.3.x86_64.rpm | 143 kB 00:00
---------------------------------------------------------------------------------------
Total 322 kB/s | 299 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-Config-General 1/5
Installing : openib 2/5
Installing : libibverbs 3/5
Installing : librdmacm 4/5
Installing : scsi-target-utils 5/5

Installed:
scsi-target-utils.x86_64 0:0.0-6.20091205snap.el5_5.3

Dependency Installed:
libibverbs.x86_64 0:1.1.3-2.el5 librdmacm.x86_64 0:1.0.10-1.el5 openib.noarch 0:1.4.1-5.el5 perl-Config-General.noarch 0:2.40-1.el5

Complete!
[root@localhost ~]#

2. Cek file configurasi ada di /etc/iscsi/ :

[root@localhost ~]# cd /etc/iscsi/

[root@localhost iscsi]# ls -l
total 16
-rw-r--r-- 1 root root 49 Mar 24 10:38 initiatorname.iscsi
-rw------- 1 root root 9072 Nov 18 07:28 iscsid.conf

3. Untuk melihat iqn number linuxnya dapat dicek di /etc/iscsi/initiatorname.iscsi :

[root@localhost iscsi]# cat initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:f8d90139216

4. Daftarkan iqn linux tersebut di setting untuk Initiator Group pada storage server.

5. Jalankan service iscsi di linux :

[root@localhost etc]# /etc/init.d/iscsi start
iscsid dead but pid file exists
Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]

[root@localhost etc]# fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 13054 104751832+ 8e Linux LVM

Awalnya hanya ada 1 disk yaitu sda.


6. Disana terlihat belum ada target yang di kenali, untuk mengenali terget dapat dilakukan dengan cara :

[root@localhost etc]# iscsiadm -m discovery -t st -p 192.168.2.222
192.168.2.222:3260,2000 iqn.1986-03.com.ibm:sn.135022972

[root@localhost etc]# iscsiadm -m node

192.168.2.222:3260,2000 iqn.1986-03.com.ibm:sn.135022972

7. pastikan target sudah berada si library iscsi :

[root@localhost etc]# ls -l /var/lib/iscsi/nodes/iqn.1986-03.com.ibm\:sn.135022972/
total 4
drw------- 2 root root 4096 Mar 24 10:59 192.168.2.222,3260,2000

8. Restart service iscsi di linux nya :


[root@localhost etc]# /etc/init.d/iscsi stop
Stopping iSCSI daemon:
[root@localhost etc]# /etc/init.d/iscsi start
iscsid dead but pid file exists
Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.1986-03.com.ibm:sn.135022972, portal: 192.168.2.222,3260]
Login to [iface: default, target: iqn.1986-03.com.ibm:sn.135022972, portal: 192.168.2.222,3260]: successful
[ OK ]

9. Diatas terlihat sudah dikenali targetnya, untuk mengeceknya bisa dilihat dengan :


[root@localhost etc]# fdisk -l


Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 13054 104751832+ 8e Linux LVM

Disk /dev/sdb: 859.0 GB, 859047985152 bytes
255 heads, 63 sectors/track, 104439 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 104439 838906236 83 Linux

Disk /dev/sdc: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
[root@localhost etc]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
97G 21G 71G 23% /
/dev/sda1 99M 19M 75M 21% /boot
tmpfs 187M 0 187M 0% /dev/shm


10. Saat ini sudah ada disk baru yaitu sdb dan sdc. Tinggal yang baru tersebut dimount atau diformat sesuai keinginan
.


Dony Ramansyah
site : http://dony-ramansyah.bravehost.com
blog : dony-ramansyah.blogspot.com
email : dony.ramansyah[at]gmail.com
Registered linux user : ID 400171

No comments: