LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1655|回复: 5

linux下制作raid快速教程

[复制链接]
发表于 2005-4-19 13:46:37 | 显示全部楼层 |阅读模式
来自Steve's RHCE Study Guide
Steve Bremer, steve at clublinux dot org
v .10, April 10th, 2002



RAID
12.1 Overview
Stands for Redundant Array of Inexpensive Disks or Redundant Array of Independent Disks. It uses multiple disks to increase performance and/or reduce the chances of data loss due to hardware failure.


12.2 Supported Versions

Striping (RAID 0) 条带
No Redundancy 无冗余
Fastest read/write performance. 快速读写
Requires 2 or more disks. 要求2个以上的磁盘

Mirroring (RAID 1) 镜像
Requires 2 or more disks.
Fast read performance.
Requires 2x actual storage size requirements.

Data and Parity Striping (RAID 5)
Requires 3 or more disks.
More efficient use of disk space than RAID 1.

12.3 Partition Type 分区类型
Set partition type to 0xFD for auto detection of RAID devices (use option 't' in fdisk).


12.4 Configuration File (/etc/raidtab) 创建 /etc/raidtab
See raidtab man page for an example.

Sample file:

### RAID 1
raiddev               /dev/md0   设备名
raid-level            1         # Mirroring     raid级别
nr-raid-disks         3         # Number of disks to use  使用的磁盘数(从1算起)
nr-spare-disks        1         # Hot standby in case another fails 后备磁盘
persistent-superblock 1         # Required for auto detection 开启系统自动识别功能
chunk-size            32        # In KB    单位条带尺寸(K) 一般4k-128k

device                /dev/hda3
raid-disk             0                从0开始算起
device                /dev/hdb3
raid-disk             1
device                /dev/hde5
raid-disk             2
device                /dev/hdc4
spare-disk            0

### RAID 5
raiddev               /dev/md1
raid-level            5         # Data and parity striping
nr-raid-disks         3         # Number of disks to use
nr-spare-disks        1         # Hot standby in case another fails
persistent-superblock 1         # Required for auto detection
chunk-size            32        # In KB
parity-algorithm      right-symmetric(只用于raid 5)

device                /dev/sda1
raid-disk             0
device                /dev/sdb3
raid-disk             1
device                /dev/sdc5
raid-disk             2
device                /dev/sdd4
spare-disk            0

12.5 Initializing RAID devices

mkraid /dev/md0  初始化raid设备
mkraid /dev/md1

NOTE: mkraid also causes necessary RAID modules to be loaded by kernel as if raidstart had been executed.

12.6 Formatting RAID devices 格式化raid,创建文件系统

mke2fs -b 4096 -R stride=8 /dev/md0      -b 4096 指定每block大小为4096字节
mke2fs -b 4096 -R stride=8 /dev/md1      

"-R" is used to set RAID related options for the file system. Stride is the number of blocks per chunk. In the previous examples we are using a 32K chunk size with a 4K block size, so stride has to be 8 (4K * 8 = 32K).


12.7 RAID 5 parity options
Specify parity algorithm with the "parity-algorithm" option in /etc/raidtab. Possible values are:

left-asymmetric
right-asymmetric
left-symmetric
right-symmetric
Left-symmetric offers the maximum performance on typical disks with rotating platters.


12.8 Auto detection of RAID arrays
Requires:

Partition type must be set to 0xFD.
Auto detection must be turned on in kernel.
Must specify "persistent-superblock 1"通知内核开启raid自动识别 in /etc/raidtab
为什么不能注册 该用户已被删除
发表于 2005-6-7 20:37:20 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

发表于 2005-6-8 02:36:51 | 显示全部楼层
Post by 为什么不能注册
请问,如果在一个有磁盘上做软raid哪应该怎么设置啊

请看本版的置顶贴里的raid部分。软raid的设置其实很简单,只要参考/usr/share/doc/raid-*/下的配置文件就可以了。
回复 支持 反对

使用道具 举报

为什么不能注册 该用户已被删除
发表于 2005-6-8 17:51:45 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

为什么不能注册 该用户已被删除
发表于 2005-6-9 12:40:16 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

为什么不能注册 该用户已被删除
发表于 2005-6-9 13:27:23 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表