1、Raid定义
RAID,全称Redundant Array of Inexpensive Disks,中文名为廉价磁盘冗余阵列。RAID可分为软RAID和硬RAID,软RAID是通过软件实现多块硬盘冗余的。而硬RAID是一般通过RAID卡来实现RAID的。前者配置简单,管理也比较灵活。对于中小企业来说不失为一最佳选择。硬RAID往往花费比较贵。不过,在性能方面具有一定优势。
2、RAID分类
RAID可分为以下几种,做个表格认识下:
RAID 0 :存取速度最快 没有容错
RAID 1 :完全容错 成本高,硬盘使用率低。
RAID 3 :写入性能最好 没有多任务功能
RAID 4 :具备多任务及容错功能 Parity 磁盘驱动器造成性能瓶颈
RAID 5 :具备多任务及容错功能 写入时有overhead
RAID 0+1 :速度快、完全容错 成本高
3、Linux RAID 5 实验详解
假设我有4块硬盘,(没有条件的朋友可以用虚拟机设置出4块硬盘出来)。分别为/dev/sda /dev/sdb /dev/sdc /dev/sdd。
(1)首先做的就是分区了。
[root@localhost /]# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n #按n创建新分区
Command action
e extended
p primary partition (1-4) #输入p 选择创建主分区
p
Partition number (1-4): 1 #输入 1 创建第一个主分区
First cylinder (1-130, default 1): #直接回车,选择分区开始柱面这里就从 1 开始
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-102, default 130):
Using default value 130
Command (m for help): w #然后输入w写盘
The partition table has been> Calling ioctl() to re-read partition table.
Syncing disks.
其它分区照这样做全部分出一个区出来。下面是总分区信息:
[root@localhost /]# fdisk -l
Disk /dev/sda: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks> /dev/sda1 1 130 1044193+ 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks> /dev/sdb1 1 130 1044193+ 83 Linux
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks> /dev/sdc1 1 130 1044193+ 83 Linux
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes