iSCSI設定

先將帳密keyin到/etc/iscsi/iscsid.conf
node.session.auth.username = <帳號>
node.session.auth.password = <密碼>
discovery.sendtargets.auth.username = <帳號>
discovery.sendtargets.auth.password = <密碼>

掃瞄一下該IP有無iscsi target,列出三個
[root@photo iscsi]# iscsiadm -m discovery -t sendtargets -p 203.64.153.x
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.qnap.c08871
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.cdtower.c08871
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871

重新啟動iscsi 服務
[root@photo iscsi]# service iscsi restart
正在停止 iscsi:                                           [  確定  ]
正在啟動 iscsi:iscsiadm: Could not login to [iface: default, target: iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871, portal: 203.64.153.x,3260].
iscsiadm: initiator reported error (24 – iSCSI login failed due to authorization failure)
iscsiadm: Could not login to [iface: default, target: iqn.2004-04.com.qnap:ts-809u:iscsi.qnap.c08871, portal: 203.64.153.x,3260].
iscsiadm: initiator reported error (24 – iSCSI login failed due to authorization failure)iscsiadm: Could not login to [iface: default, target: iqn.2004-04.com.qnap:ts-809u:iscsi.cdtower.c08871, portal: 203.64.153.x,3260].
iscsiadm: initiator reported error (24 – iSCSI login failed due to authorization failure)iscsiadm: Could not log into all portals                                                           [  確定  ]

先看看該IP有哪些iscsi target
[root@photo iscsi]# iscsiadm -m node
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.qnap.c08871
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.cdtower.c08871

登入iscsi設備
[root@photo iscsi]# iscsiadm –mode node –targetname iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871  –login
Logging in to [iface: default, target: iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871, portal: 203.64.153.x,3260] (multiple)
Login to [iface: default, target: iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871, portal: 203.64.153.x,3260] successful.

[root@photo iscsi]#

下fdisk -l指令看看有無新空間進來,有的,/dev/sdb有539GB
[root@photo iscsi]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00095fee

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2089    16264192   8e  Linux LVM

Disk /dev/mapper/vg_template-lv_root: 12.4 GB, 12423528448 bytes
255 heads, 63 sectors/track, 1510 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000

Disk /dev/mapper/vg_template-lv_root doesn’t contain a valid partition table
Disk /dev/mapper/vg_template-lv_swap: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000

Disk /dev/mapper/vg_template-lv_swap doesn’t contain a valid partition table
Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000
Disk /dev/sdb doesn’t contain a valid partition table

現在把不要的iscsi target 刪掉
[root@photo iscsi]# iscsiadm -m node -o delete -T iqn.2004-04.com.qnap:ts-809u:iscsi.qnap.c08871
[root@photo iscsi]# iscsiadm -m node -o delete -T iqn.2004-04.com.qnap:ts-809u:iscsi.cdtower.c08871
[root@photo iscsi]# iscsiadm -m node
203.64.153.x:3260,1 iqn.2004-04.com.qnap:ts-809u:iscsi.photo.c08871

將新空間FDISK(詳細方法先FDISK userguide)
[root@photo iscsi]#fdisk /dev/sdb
[root@photo iscsi]#mkfs.ext4 /dev/sdb1
[root@photo iscsi]#mkdir /mnt/iscsi_photo
[root@photo iscsi]#mount /dev/sdb1 /mnt/iscsi_photo/
[root@photo iscsi]#echo ‘mount /dev/sdb1 /mnt/iscsi_photo/’ >> /etc/rc.local

現在無聊測一下iscsi的I/O速度
[root@photo iscsi_photo]# hdparm -tT /dev/sdb1
/dev/sdb1:
Timing cached reads:   4240 MB in  2.00 seconds = 2120.31 MB/sec
Timing buffered disk reads:  274 MB in  3.00 seconds =  91.23 MB/sec

[root@photo iscsi_photo]#cd /var/www/html/cpg
[root@photo iscsi_photo]#rm -rf albums
[root@photo iscsi_photo]#ln -s /mnt/iscsi_photo albums

完工!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值