1. mount /dev/cdrom /mnt/cdrom color:#555555">2. [root@looklo ~]# vim /etc/yum.repos.d/rhel-source.repo [rhel-source] name=Red Hat Enterprise Linux $releasever - $basea"/> 1. mount /dev/cdrom /mnt/cdrom color:#555555">2. [root@looklo ~]# vim /etc/yum.repos.d/rhel-source.repo [rhel-source] name=Red Hat Enterprise Linux $releasever - $basea"/>
color:#555555">1. mount /dev/cdrom /mnt/cdrom
color:#555555">2.
[root@looklo ~]# vim /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
color:#555555">3.
安裝方法一:
查找包
[root@looklo ~]# yum search iscsi
安裝包
[root@looklo ~]# yum install iscsi-initiator-utils.x86_64 –y
安裝方法二:
find -name iscsi*
rpm -ivh ./Server/iscsi-initiator-utils-6.2.0.868-0.18.el5.i386.rpm
安裝成功后,會產生下面目錄
運行此命令后,會生成一個目錄/etc/iscsi,該目錄下有兩個文件:
color:red">4. service iscsi start 或
/etc/init.d/iscsi start
5.搜索盤陣:
運行以下命令搜尋target,即目標端:存儲設備
命令格式:[root@linux ~]#iscsiadm --mode discovery --type sendtargets --portal ipaddress
iscsiadm -m discovery -t sendtargets -p 192.168.0.230
6.顯示盤陣:
顯示存儲端target name
eg:
[root@localhost cdrom]# iscsiadm -m node
7.登錄盤陣
命令格式:target登陸
[root@linux ~]#iscsiadm --mode node --targetname targetname --portal 192.168.0.230:3260 --login
eg:
[root@localhost cdrom]# iscsiadm -m node -T iqn.2001-05.com.equallogic:0-290c06-cb5684bd1-00a4abe3c9d4e5ca-pillar -p 192.168.0.230:3260 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.959c083bcac2, portal: 100.1.1.5,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.959c083bcac2, portal: 100.1.1.5,3260]: successful
[root@localhost cdrom]#
經過以上幾步,fdisk–l就可以看到所掛接分區了!!!
(為確保重啟后也能看到,再修改一下
iscsiadm -m node -T iqn.2001-05.com.equallogic:0-290c06-cb5684bd1-00a4abe3c9d4e5ca-pillar -p 192.168.0.230:3260 –l
添加到該文件中的開始部分.
設置服務啟動chkconfig --level 35 iscsid .)
其實這個文件大多數內容處於被註釋狀態,該命令添加位置應該影響不大.然後重啟電腦後直接fdisk –l 依然可以看到所掛接的分區.至此iscsi所有操作完成,但掛載的分區不是linux所識別,必須使用FDISK進行磁碟分區.
8.設置分區
使用fdisk命令進行磁碟分區
fdisk是各種Linux
[root@localhost ~]# fdisk /dev/sdb 查看磁碟信息
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
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-1011, default 1):
Using default value 1
Last cylinder or size or sizeM or sizeK (1-1011, default 1011):
Using default value 1011
Command (m for help): w 保存分區信息
The partition table has been altered!
9.檢驗新分區
[root@localhost ~]# fdisk /dev/sdb
Command (m for help): p
Disk /dev/sda: 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/sda1 1 1011 1048376 83 Linux
10.格式化分區
[root@localhost ~]# mkfs -t ext3 /dev/sdb1
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
11.設定載入點
文件系統必須有一個掛載點,它只是一個空的目錄,新文件系統在這裡與系統目錄樹“相連”.
經過以上的操作,Linux伺服器已經連接到 iSCSI 儲存設備, 並且如同Linux 本機上面的一個 SCSI 硬碟一樣. 使用的方式幾乎一模一樣.
[root@localhost mnt]#
12.設定自動掛載
在機器重新啟動后自動載入分區,必須在
本文出自 「IT-愛好者」 博客,請務必保留此出處http://pillarmanocean.blog.51cto.com/2349508/795623
[火星人 ] Linux Iscsi 安裝和配置已經有737次圍觀