linux系統下安裝配置iSCSI教程

測試系統爲Redhat 5.4,內核版本爲2.6.18,iSCSI Server已經配置好,此處不再說明。

 

1、  安裝iSCSI Initiator

 

a) 使用命令mount /dev/cdrom /media掛載Redhat5.4安裝光盤到/media下。

 

b) 使用命令rpm --ivh /media/Server/iscsi-initiator-utils-6.2.0.871-0.7.el5.i386.rpm安裝iscsi Initiator。

 

c) 使用命令rpm --qa | grep iscsi確認系統中已經成功安裝了iscsi Initiator。並且在/etc下會產生iscsi文件夾,該文件夾下同時生成兩個文件initiatorname.iscsi、iscsid.conf。

 

d) 使用命令chkconfig --list查看iscsi、iscsid服務在運行級別3、5中是否屬於自動啓動狀態。(注意:如果不是可以使用chkconfig --level將其設置爲自動啓動。

 

如果iscsid和iscsi沒有隨系統的啓動而啓動,則用chkconfig設置這兩個服務在系統運行級別爲3和5時隨系統啓動而啓動

# chkconfig iscsi --level 345 on
# chkconfig iscsid --level 345 on

 

 

2、  執行Target發現。

 

a) 首先使用命令/etc/init.d/iscsid start啓動iscsi守護進程。

 

b) 用命令iscsiadm –m discovery –t sendtargets –p 192.168.1.92發現192.168.1.92上的iscsi資源。

 

c) 使用命令iscsiadm –m node查看已發現的所有iscsi資源(該步驟可選)

 

 

3、  設置Initiator Name。

 

a) 編輯/etc/iscsi/initiatorname.iscsi文件,將“InitiatorName=”後的內容改爲之前發現的iscsi資源名,如圖:

 

b) 編輯/etc/iscsi/iscsid.conf文件,將“# isns.address = 192.168.0.1”前的“#”去掉,並將IP地址改爲ISCSI Server的IP地址192.168.1.92。將“isns.port = 3205”前的“#”去掉並將端口號改爲3260如圖:

 

4、  啓動iscsi服務,將通過iscsi掛載的磁盤分區格式化。

 

a) 使用命令/etc/init.d/iscsi start啓動iscsi服務,此時將會掛載iscsi設備,如圖。

 

b) 使用fdisk –l可以查看到系統中多了一塊硬盤/dev/sdb,這便是通過iscsi掛載而來。

 

如果顯示 disk /dev/sdb doesn’t contain a vilid partition table

需要運行以下命令進行掛載

# fdisk /dev/sdf
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): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1009, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1009, default 1009):
Using default value 1009
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章