将单位里闲置的服务器配制成网络存储设备,这样可以节省公司成本。


第一步:找一台存储型的服务器,在上面安装openfiler系统,这个系统安装类似centos的安装。需要注意的事项是,把系统分区设置成主引导区。选择“force to be a primary partition”

第二步:配置openfiler,简要步骤:
 1、在services里开启iscsi target服务
 2、volume---block device management(配置物理磁盘,类似格式化)
       如果需要创建raid,先要进行software RAID操作
 3、add volume -----创建VG(filesystem/volume type:选择iscsi)
 4、选择iscsi targets,页面添加。然后映射,配置网络ACL。
 5、在status里面,可以看到iscsi的状态

第三步:客户端挂载
这里以centos6.0_x64为例
[root@host104 ~]# rpm -qa | grep iscsi     ----------检查有没有安装iscsi
[root@host104 ~]# yum -y install iscsi*
[root@host104 ~]# service iscsi start               还可以添加chkconfig列表中

[root@host104 ~]# iscsiadm -m discovery -t sendtargets -p 172.31.44.108    发现iscsi target设备
Starting iscsid: [ OK ]
:3260,1 iqn.2006-01.com.openfiler:tsn.a116796c90e0
:3260,1 iqn.2006-01.com.openfiler:tsn.5c6d16d3aa52
:3260,1 iqn.2006-01.com.openfiler:tsn.31d6637fcb1f
:3260,1 iqn.2006-01.com.openfiler:tsn.c990aa5aa177
:3260,1 iqn.2006-01.com.openfiler:tsn.9eef84de424b
:3260,1 iqn.2006-01.com.openfiler:tsn.bad5f704c901
:3260,1 iqn.2006-01.com.openfiler:tsn.b36c9494f927
:3260,1 iqn.2006-01.com.openfiler:tsn.2e34f62a0b4f
[root@host104 ~]#
[root@host104 ~]#
[root@host104 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.a116796c90e0 -p 172.31.44.108 -l     ------------挂载,这个可以写到rc.local里面,在重启之后可以自动挂载。
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.a116796c90e0, portal: 172.31.44.108,3260] (multiple)
Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.a116796c90e0, portal: 172.31.44.108,3260] successful.
[root@host104 ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0x000799ff
  Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 141 1024000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 141 5222 40815616 83 Linux
Disk /dev/sdb: 104.9 GB, 104857600000 bytes    ------------------挂载的设备
255 heads, 63 sectors/track, 12748 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: 0x00000000
然后再进行格式化,挂载分区。