您的位置:首页 > 其它

iSCSI設定

2013-10-04 10:01 288 查看
先將帳密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

完工!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: