<公司Linux服務器掛載一台存儲操作實例>
Linux操作系統:RedhatLinux-4
安裝包:1.iscsi-initiator-utils-4.0.3.0-8.x86_64.rpm
2.iscsitarget-0.4.15.tar.gz
第一步:存儲IP配置
/etc/sysconfig/network-scripts
[root@eisp02 network-scripts]# vi ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=xx.xx.xx.255
HWADDR=00:25:B3:22:xx:xx
IPADDR=xx.xx.xx.144
NETMASK=255.255.255.0
NETWORK=xx.xx.xx.0
ONBOOT=yes
TYPE=Ethernet
[root@eisp02 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=static
HWADDR=00:25:B3:22:xx:xx
ONBOOT=yes
TYPE=Ethernet
DHCP_HOSTNAME=eisp02
IPADDR=192.168.0.4
NETMASK=255.255.255.0
NETWORK=192.168.0.0
[root@eisp02 network-scripts]# cat ifcfg-eth3
DEVICE=eth3
BOOTPROTO=static
HWADDR=00:25:B3:22:xx:xx
ONBOOT=yes
TYPE=Ethernet
DHCP_HOSTNAME=eisp02
IPADDR=192.168.1.4
NETMASK=255.255.255.0
NETWORK=192.168.1.0
此為存儲上對應的網線接入端口A2\B2
第二步:安裝ISCSI客戶端軟件(root身份登錄)
1.iscsi-initiator-utils-4.0.3.0-8.x86_64.rpm
(rpm -Uvh iscsi-initiator-utils-4.0.3.0-8.x86_64.rpm )
2.iscsitarget-0.4.15.tar.gz
#解壓縮:tar xvzf 安裝包iscsitarget-0.4.15.tar.gz
cd iscsitarget-0.4.15.tar.gz 目錄下
#檢查編譯:./configure (無法執行或直接跳過此步)
#:make
#:make install
【tar zxvf iscsitarget-0.4.15.tar.gz】
【cd iscsitarget-0.4.15.tar.gz/】
【make】
【make install】
第三步:配置ISCSI相關服務文件
1.vi /etc/ietd.conf
Target iqn.1987-05.com.cisco:01.2367af7bb47
IncomingUser root oracle
OutgoingUser
Lun 0 Path=/dev/sdb,Type=fileio
Alias lun0
2.vi /etc/iscsi.conf
DiscoveryAddress=192.168.0.3
SendAsyncText=yes
Continuous=yes
接下來啟動ISCSI服務
啟動iscsitarget
/etc/init.d/iscsi-target start
啟動iscsid
/etc/init.d/iscsid start
第四步:開始掛載存儲
#mkdir /oracle/HP
#mount /dev/sdb /oracle/HP
查看iscsi設備:iscsi-ls
查看已掛載存儲:fdisk -l
#一台全新的存儲設備在第一次掛載時需要做磁盤設置
fdisk -l 此時會有設置問題
Disk /dev/sdb doesn't contain a valid partition table
#fdisk /dev/sdb 一步步設置分區磁盤
Command (m for help):n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):1
First cylinder (1-14098, default 1):(直接回車)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-14098, default 14098): (直接回車)
Using default value 14098
Command (m for help):p
下面是已經掛載的情況:
[root@eisp02 oracle]# fdisk -l
【Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 131 1052226 83 Linux
/dev/cciss/c0d0p2 132 6658 52428127+ 83 Linux
/dev/cciss/c0d0p3 6659 10835 33551752+ 82 Linux swap
/dev/cciss/c0d0p4 10836 17844 56299792+ 5 Extended
/dev/cciss/c0d0p5 10836 17844 56299761 83 Linux
Disk /dev/sda: 1466.5 GB, 1466521354240 bytes
255 heads, 63 sectors/track, 178294 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 178294 1432146523+ 83 Linux
Disk /dev/sdb: 1466.5 GB, 1466521354240 bytes
255 heads, 63 sectors/track, 178294 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 178294 1432146523+ 83 Linux】
附上磁盤設置分區命令:
#fdisk /dev/sdb 設置磁盤分區命令:
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
第五步:磁盤使用劃分
doing.....