VM实现ISCSI安装在WINDOWS、LINUX下简单使用
虚拟机2块网卡
系统:XP
VM:linux
WINDOWS
安装Targets for WINDOWS
安装 initiator for WINDOWS
StarWind2.6.4安装后Targets、initiator都存在了。
没有什么好说的了,直接添加连接和配置就可以了。
注:windows下先安装SCSI驱动:Initiator-2.08-build3825-x86fre.exe
安装完后在磁盘管理里面可以看见新添加的磁盘或卷,可以正常使用了。
====================================================================================================
LINUX:
安装 initiator for LINUX
安装软件
[root@web1 etc]# rpm -qa|grep iscsi
iscsi-initiator-utils-4.0.3.0-4
[root@web1 ~]# grep -v "#" /etc/iscsi.conf
DiscoveryAddress=10.10.10.151:3260
TargetName=iqn.1987-05.com.cisco:00.0d1d898e8d66.t0
Enabled=yes
启动iscsi
[root@web1 /]# /etc/rc.d/init.d/iscsi start
Checking iscsi config: [ OK ]
Loading iscsi driver: [ OK ]
mknod: `/dev/iscsictl': File exists
Starting iscsid: [ OK ]
查看服务启动是否正常
[root@web1 ~]# ps -ef|grep iscsi
root 7928 1 0 19:09 ? 00:00:00 /sbin/iscsid
root 7931 7928 0 19:09 ? 00:00:00 /sbin/iscsid
root 7933 1 0 19:09 ? 00:00:00 [scsi_eh_4]
root 7934 3 0 19:09 ? 00:00:00 [iscsi-tx]
root 7935 3 0 19:09 ? 00:00:00 [iscsi-rx]
root 7937 1 0 19:09 ? 00:00:00 [scsi_eh_5]
root 7938 3 0 19:09 ? 00:00:00 [iscsi-tx]
root 7939 3 0 19:09 ? 00:00:00 [iscsi-rx]
root 7954 1 0 19:09 ? 00:00:00 [scsi_eh_6]
root 8016 3 0 19:09 ? 00:00:01 [iscsi-tx]
root 8017 3 0 19:09 ? 00:00:00 [iscsi-rx]
root 10573 1 0 19:23 ? 00:00:00 [kjournald]
查看模块是否加载
[root@web1 /]# lsmod|grep scsi
iscsi_sfnet 94801 3
scsi_transport_iscsi 8385 1 iscsi_sfnet
mptscsih 1601 0
mptsas 10061 1 mptscsih
mptspi 9805 4 mptscsih
mptfc 9033 1 mptscsih
mptscsi 44173 3 mptsas,mptspi,mptfc
mptbase 59169 4 mptsas,mptspi,mptfc,mptscsi
scsi_mod 122573 6 iscsi_sfnet,mptsas,mptspi,mptfc,mptscsi,sd_mod
查看磁盘是否识别
[root@web1 ~]# iscsi-ls -l
*******************************************************************************
SFNet iSCSI Driver Version ...4:0.1.11-3(02-May-2006)
*******************************************************************************
TARGET NAME : iqn.2003-06.com.rocketdivision.starwind:test.ramdisk.ramdrive0
TARGET ALIAS :
HOST ID : 4
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:55 CST 2009
SESSION ID : ISID 00023d000001 TSIH 23
DEVICE DETAILS:
---------------
LUN ID : 0
Vendor: ROCKET Model: RAM Model: DISK Model: 16 Model: MB Rev: 0001
Type: Direct-Access ANSI SCSI revision: 03
page83 type2: 0100000000000000
page80: 4449534b0a
Device: /dev/sdc
*******************************************************************************
TARGET NAME : 1
TARGET ALIAS :
HOST ID : 5
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:54 CST 2009
SESSION ID : ISID 00023d000001 TSIH 25
DEVICE DETAILS:
---------------
LUN ID : 0
Vendor: ROCKET Model: RAM Model: DISK Model: 16 Model: MB Rev: 0001
Type: Direct-Access ANSI SCSI revision: 03
page83 type2: 0200000000000000
page80: 4449534b0a
Device: /dev/sdd
*******************************************************************************
TARGET NAME : 3
TARGET ALIAS :
HOST ID : 6
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:58 CST 2009
SESSION ID : ISID 00023d000001 TSIH 27
DEVICE DETAILS:
---------------
LUN ID : 0
Vendor: ROCKET Model: RAM Model: DISK Model: 16 Model: MB Rev: 0001
Type: Direct-Access ANSI SCSI revision: 03
page83 type2: 0300000000000000
page80: 4449534b0a
Device: /dev/sde
*******************************************************************************
查看已经有新磁盘/dev/sdc、/dev/sdd:、/dev/sde 被系统识别出来。
[root@web1 etc]# fdisk -l|grep Disk
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sda: 10.7 GB, 10737418240 bytes
Disk /dev/sdb: 8589 MB, 8589934592 bytes
Disk /dev/sdc: 16 MB, 16777216 bytes
Disk /dev/sdd: 16 MB, 16777216 bytes
Disk /dev/sde: 16 MB, 16777216 bytes
[root@web1 iscsi]# iscsi-device /dev/sde
/dev/sde is an iSCSI device
[root@web1 iscsi]# iscsi-iname
iqn.1987-05.com.cisco:01.1987eb6f65
[root@web1 iscsi]# netstat -antup|grep iscsi
tcp 0 0 10.10.10.10:34291 10.10.10.151:3260 ESTABLISHED 7931/iscsid
[root@web1 etc]# iscsi-ls
*******************************************************************************
SFNet iSCSI Driver Version ...4:0.1.11-3(02-May-2006)
*******************************************************************************
TARGET NAME : iqn.2003-06.com.rocketdivision.starwind:test.ramdisk.ramdrive0
TARGET ALIAS :
HOST ID : 4
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:55 CST 2009
SESSION ID : ISID 00023d000001 TSIH 23
*******************************************************************************
TARGET NAME : 1
TARGET ALIAS :
HOST ID : 5
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:55 CST 2009
SESSION ID : ISID 00023d000001 TSIH 25
*******************************************************************************
TARGET NAME : 3
TARGET ALIAS :
HOST ID : 6
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 10.10.10.151:3260,1
SESSION STATUS : ESTABLISHED AT Mon Jan 19 19:09:57 CST 2009
SESSION ID : ISID 00023d000001 TSIH 27
*******************************************************************************
接下来就是
[root@web1 etc]# mkfs.ext3 /dev/sde
mke2fs 1.35 (28-Feb-2004)
/dev/sde is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
4096 inodes, 16384 blocks
819 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=16777216
2 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
建立挂载点
[root@web1 etc]# mkdir /iscsi
mount新硬盘
[root@web1 etc]# mount /dev/sde /iscsi
[root@web1 etc]# cd /iscsi/
[root@web1 iscsi]# ls
lost+found
[root@web1 iscsi]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
9643660 2855840 6297940 32% /
/dev/sda1 101086 12759 83108 14% /boot
none 127932 0 127932 0% /dev/shm
/dev/sde 15863 1170 13874 8% /iscsi
最后可以把新加的随意使用了,LVM,直接当硬盘使用都可以了。
====================================================================================================
阅读(2024) | 评论(0) | 转发(0) |