티스토리 뷰

System Story/CentOS 5,6

iSCSI Initiator 설정 및 Target 마운트

불량펭귄 helperchoi 2013. 11. 10. 20:19

※ Linux 에서 iSCSI 프로토콜을 이용하여 iSCSI Disk volume 마운트

 

[root@TEST02 ~]# 
[root@TEST02 ~]# chkconfig --list | grep iscsi
iscsi           0:off 1:off 2:off 3:on 4:off 5:on 6:off
iscsid         0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@TEST02 ~]# 
[root@TEST02 ~]# service iscsi status
iscsid (pid  1259) is running...
[root@TEST02 ~]# 
[root@TEST02 ~]# service iscsid status
iscsid (pid  1259) is running...
[root@TEST02 ~]# 
[root@TEST02 ~]# iscsiadm -m discovery -t st -p 192.168.137.10
192.168.137.10:3260,1 iqn.2013-09.192.168.137.10:storage.iscsi1
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# iscsiadm -m node
192.168.137.10:3260,1 iqn.2013-09.192.168.137.10:storage.iscsi1
[root@TEST02 ~]# 
[root@TEST02 ~]#
[root@TEST02 ~]# iscsiadm -m session
tcp: [1] 192.168.100.254:3260,1 iqn.2013-09.192.168.137.10:storage.iscsi1
[root@TEST02 ~]#
[root@TEST02 ~]# 
[root@TEST02 ~]# iscsiadm -m node -p 192.168.137.10:3260 -T iqn.2013-09.192.168.137.10:storage.iscsi1 --login
Logging in to [iface: default, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260] (multiple)
Login to [iface: default, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260] successful.
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# cat /proc/scsi/scsi                            
Attached devices:                                                
Host: scsi4 Channel: 00 Id: 00 Lun: 05                           
  Vendor: NEXENTA  Model: COMSTAR          Rev: 1.0              
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 06                           
  Vendor: NEXENTA  Model: COMSTAR          Rev: 1.0              
  Type:   Direct-Access                    ANSI SCSI revision: 05
                                              
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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        1305    10377990   8e  Linux LVM

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
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# fdisk /dev/sdb
n -> p -> 1 -> Enter -> Enter -> t -> 83 -> w
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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        1305    10377990   8e  Linux LVM

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
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# mkfs.ext3 /dev/sdb1 
[root@TEST02 ~]# 
[root@TEST02 ~]# mkdir /iSCSI
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# mount -t ext3 /dev/sdb1 /iSCSI
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# cd /iSCSI/
[root@TEST02 iSCSI]# ll
total 16
drwx------ 2 root root 16384 Sep 17 12:50 lost+found
[root@TEST02 iSCSI]# 
[root@TEST02 iSCSI]# touch aaa
[root@TEST02 iSCSI]# 
[root@TEST02 iSCSI]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# echo "/dev/sdb1 /iSCSI ext3 _netdev 0 0" >> /etc/fstab 
[root@TEST03 ~]# 
[root@TEST03 ~]# 
[root@TEST03 ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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        1305    10377990   8e  Linux LVM

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
[root@TEST03 ~]# 
[root@TEST03 ~]# 
[root@TEST03 ~]# 
[root@TEST03 ~]#  mount -t ext3 /dev/sdb1 /iSCSI
mount: special device /dev/sdb1 does not exist
[root@TEST03 ~]# 
[root@TEST03 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 ~]# mount -l | grep SCSI
/dev/sdb1 on /iSCSI type ext3 (rw)
[root@TEST02 ~]# 
[root@TEST02 ~]# umount /dev/sdb1
[root@TEST02 ~]# 
[root@TEST02 ~]# 
[root@TEST02 /]# 
[root@TEST02 /]# iscsiadm -m node --targetname iqn.2013-09.192.168.137.10:storage.iscsi1 --logout
Logging out of session [sid: 1, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260]
Logout of [sid: 1, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260] successful.
[root@TEST02 /]# 
[root@TEST02 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# iscsiadm -m discovery -t st -p 192.168.137.10 (또는 iscsiadm --mode discoverydb --type sendtargets --portal 192.168.137.10 --discover )
192.168.137.10:3260,1 iqn.2013-09.192.168.137.10:storage.iscsi1
[root@TEST03 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# iscsiadm -m node -p 192.168.137.10:3260 -T iqn.2013-09.192.168.137.10:storage.iscsi1 --login
Logging in to [iface: default, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260] (multiple)
Login to [iface: default, target: iqn.2013-09.192.168.137.10:storage.iscsi1, portal: 192.168.137.10,3260] successful.
[root@TEST03 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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        1305    10377990   8e  Linux LVM

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
[root@TEST03 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# mount -t ext3 /dev/sdb1 /iSCSI
[root@TEST03 /]# 
[root@TEST03 /]# 
[root@TEST03 /]# mount -l | grep SCSI
/dev/sdb1 on /iSCSI type ext3 (rw)
[root@TEST03 /]# 
[root@TEST03 /]# ls -l /iSCSI/
total 16
-rw-r--r-- 1 root root     0 Sep 17 12:50 aaa
drwx------ 2 root root 16384 Sep 17 12:50 lost+found
[root@TEST03 /]# 
[root@TEST03 /]# 
반응형

'System Story > CentOS 5,6' 카테고리의 다른 글

iSCSI target Logout 및 삭제  (0) 2013.11.10
iSCSI Target 서버 구성  (0) 2013.11.10
iSCSI Initiator 설정 및 Target 마운트  (0) 2013.11.10
간단한 iptables sample 형식  (0) 2013.11.10
IP Alias  (0) 2013.11.10
iostat 시 항목별 소트 (ex I/O await) 및 사용예제  (0) 2013.11.10
댓글
댓글쓰기 폼