使用NetBSD构建基于iSCSI的小型SAN
来源:互联网
作者:west263.com
时间:2008-04-16
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!
输出:
# /dev/rraid5d:
type: RAID
disk: raid
label: fictitious
flags:
bytes/sector: 512
sectors/track: 64
tracks/cylinder: 12
sectors/cylinder: 768
cylinders: 5461
total sectors: 4194176
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
type: RAID
disk: raid
label: fictitious
flags:
bytes/sector: 512
sectors/track: 64
tracks/cylinder: 12
sectors/cylinder: 768
cylinders: 5461
total sectors: 4194176
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
4 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 4194176 0 4.2BSD 0 0 0 # (Cyl. 0 - 5461*)
d: 4194176 0 unused 0 0 # (Cyl. 0 - 5461*)
disklabel: boot block size 0
disklabel: super block size 0
创建文档系统
# newfs -O 2 /dev/raid5a
这里我们创建的是UFS2的文档系统。
接下来加载新的文档系统:
# mkdir /r5
# mount /dev/raid5a /r5
# mount /dev/raid5a /r5
查看加载情况(这里sd0,sd1,sd2,sd3都为1G的SCSI硬盘)
# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 497M 23M 449M 4% /
/dev/wd0e 2.2G 189M 1.9G 8% /usr
kernfs 1.0K 1.0K 0B 100% /kern
/dev/raid5a 1.9G 2.0K 1.8G 0% /r5
Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 497M 23M 449M 4% /
/dev/wd0e 2.2G 189M 1.9G 8% /usr
kernfs 1.0K 1.0K 0B 100% /kern
/dev/raid5a 1.9G 2.0K 1.8G 0% /r5
现在,将/etc/iscsi/targets中的配置文档改成:
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present
#
# Structure of this file:
#
# an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present
# Simple file showing 1 extent, mapped straight into 1 target
# extent file or device start length
extent0 /r5/iscsi-target0 0 1800MB
# target flags storage netmask
target0 rw extent0 0.0.0.0/0
重新启动iSCSI服务:
# /etc/rc.d/iscsi_target restart
现在您的iSCSI数据就已保存在我们的RAID5设备上了,一个基本的SAN就已完成,快快体验您的成果吧。
由于现在iSCSI在NetBSD中还处于研发阶段加上笔者水平有限,所以某些功能还暂未实现,欢迎大家一起讨论,分享您的新发现。
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



