|
|
来自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 |
|