磁盘管理——RAID 5
来源:互联网 发布:专业java培训 编辑:程序博客网 时间:2024/06/01 17:35
一 什么是RAID5
RAID Level 5 是一种储存性能、数据安全和存储成本兼顾的存储解决方案。它使用的是Disk Striping(硬盘分割)技术。RAID 5 至少需要三颗硬碟, RAID 5不是对存储的数据进行备份,而是把数据和相对应的奇偶校验信息存储到组成RAID5的各个磁盘上,并且奇偶校验信息和相对应的数据分别存储于不同的磁盘上。当RAID5的一个磁盘数据发生损坏后,可以利用剩下的数据和相应的奇偶校验信息去恢复被损坏的数据。 RAID 5可以理解为是RAID 0和RAID 1的折衷方案。RAID 5可以为系统提供数据安全保障,但保障程度要比镜像低而磁盘空间利用率要比镜像高。RAID 5具有和RAID 0相近似的数据读取速度,只是因为多了一个奇偶校验信息,写入数据的速度相当的慢,若使用“回写快取”可以让效能改善不少。同时由于多个数据对应一个奇偶校验信息,RAID 5的磁盘空间利用率要比RAID 1高,存储成本相对较便宜。
二 RAID5演示
第一步准备磁盘
[root@serv01 ~]# ls /dev/sdb1 /dev/sdc1/dev/sdd1/dev/sdb1 /dev/sdc1 /dev/sdd1
第二步创建RAID5
[root@serv01 ~]# mdadm --C /dev/md5 —l 5 —n3 /dev/sdb1 /dev/sdc1/ /dev/sdd1[root@serv01 ~]# mdadm --create /dev/md5--level 5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1mdadm: Defaulting to version 1.2 metadatamdadm: array /dev/md5 started.[root@serv01 ~]# cat /proc/mdstatPersonalities : [raid1] [raid0] [raid6][raid5] [raid4]md5 : active raid5 sdd1[3] sdc1[1] sdb1[0] 4190208 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] unused devices: <none>
第三步 格式化
[root@serv01 ~]# mkfs.ext4 /dev/md5
第四步 修改配置文件
#追加文件[root@serv01 ~]# echo "/dev/md5 /webext4 defaults 1 2" >> /etc/fstab#创建配置文件[root@serv01 ~]# mdadm --detail --scan >/etc/mdadm.conf [root@serv01~]# cd /web[root@serv01 web]# lsconfig-2.6.32-131.0.15.el6.x86_64 initramfs-2.6.32-131.0.15.el6.x86_64.img System.map-2.6.32-131.0.15.el6.x86_64efi lost+found vmlinuz-2.6.32-131.0.15.el6.x86_64grub symvers-2.6.32-131.0.15.el6.x86_64.gz#查看详细信息[root@serv01 web]# mdadm -D /dev/md5/dev/md5: Version : 1.2 Creation Time : Thu Aug 119:49:56 2013 Raid Level : raid5 Array Size : 4190208 (4.00 GiB 4.29 GB) Used Dev Size : 2095104 (2046.34 MiB 2145.39 MB) Raid Devices : 3 Total Devices : 3 Persistence : Superblock is persistent Update Time : Thu Aug 1 20:24:482013 State : clean Active Devices : 3Working Devices : 3 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : serv01.host.com:5 (localto host serv01.host.com) UUID : a738b211:987ef2b2:e6ce9eb3:58724db1 Events : 20 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 3 8 49 2 active sync /dev/sdd1
第五步 模拟磁盘坏掉
#取消分区 o[root@serv01 web]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated.It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): oBuilding a new DOS disklabel with diskidentifier 0xc785ce7b.Changes will remain in memory only, untilyou decide to write them.After that, of course, the previous contentwon't be recoverable. Warning: invalid flag 0x0000 of partitiontable 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated.It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): wThe partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition tablefailed with error 16: Device or resource busy.The kernel still uses the old table. Thenew table will be used atthe next reboot or after you runpartprobe(8) or kpartx(8)Syncing disks.#再次查看[root@serv01 web]# mdadm -D /dev/md5/dev/md5: Version : 1.2 Creation Time : Thu Aug 119:49:56 2013 Raid Level : raid5 Array Size : 4190208 (4.00 GiB 4.29 GB) Used Dev Size : 2095104 (2046.34 MiB 2145.39 MB) Raid Devices : 3 Total Devices : 3 Persistence : Superblock is persistent Update Time : Thu Aug 1 20:25:162013 State : clean Active Devices : 3Working Devices : 3 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : serv01.host.com:5 (localto host serv01.host.com) UUID : a738b211:987ef2b2:e6ce9eb3:58724db1 Events : 20 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 3 8 49 2 active sync /dev/sdd1 #重启[root@serv01 web]# reboot#对/dev/sde分区 [root@serv01 web]# fdisk /dev/sde WARNING: DOS-compatible mode is deprecated.It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sde: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes /512 bytesI/O size (minimum/optimal): 512 bytes / 512bytesDisk identifier: 0x26eb36f1 Device Boot Start End Blocks Id System Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-261, default 1):Using default value 1Last cylinder, +cylinders or +size{K,M,G}(1-261, default 261):Using default value 261 Command (m for help): wThe partition table has been altered! Calling ioctl() to re-read partition table.Syncing disks.
第六步 添加磁盘
[root@serv01 web]# mdadm --manage /dev/md5--add /dev/sde1mdadm: added /dev/sde1[root@serv01 web]# cat /proc/mdstatPersonalities : [raid6] [raid5] [raid4]md5 : active raid5 sde1[4] sdc1[1] sdd1[3] 4190208 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] [=================>...] recovery = 85.8% (1800064/2095104) finish=0.0min speed=200007K/sec unused devices: <none>#再次查看详细信息[root@serv01 web]# mdadm --D /dev/md5mdadm: unrecognized option '--D'Usage: mdadm --help forhelp[root@serv01 web]# mdadm -D /dev/md5/dev/md5: Version : 1.2 Creation Time : Thu Aug 119:49:56 2013 Raid Level : raid5 Array Size : 4190208 (4.00 GiB 4.29 GB) Used Dev Size : 2095104 (2046.34 MiB 2145.39 MB) Raid Devices : 3 Total Devices : 3 Persistence : Superblock is persistent Update Time : Thu Aug 1 20:28:292013 State : clean Active Devices : 3Working Devices : 3 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : serv01.host.com:5 (localto host serv01.host.com) UUID : a738b211:987ef2b2:e6ce9eb3:58724db1 Events : 45 Number Major Minor RaidDevice State 4 8 65 0 active sync /dev/sde1 1 8 33 1 active sync /dev/sdc1 3 8 49 2 active sync /dev/sdd1 #重启后登录root@serv01 web]# reboot [root@larrywen disk]# ssh 192.168.1.11root@192.168.1.11's password:Last login: Thu Aug 1 20:26:07 2013 from 192.168.1.1[root@serv01 ~]# cat /proc/mdstatPersonalities : [raid6] [raid5] [raid4]md5 : active raid5 sdc1[1] sde1[4] sdd1[3] 4190208 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] unused devices: <none>
三 参考资料
http://zh.wikipedia.org/wiki/RAID
四 相关文章
- 磁盘管理——RAID 0
- 磁盘管理——RAID 1
- 磁盘管理——RAID 10
- 磁盘管理——RAID 6
- 磁盘管理——LVM
- 磁盘管理——小实验
我的邮箱:wgbno27@163.com 新浪微博:@Wentasy27 微信公众平台:JustOracle(微信号:justoracle) 数据库技术交流群:336882565(加群时验证 From CSDN XXX) Oracle交流讨论组:https://groups.google.com/d/forum/justoracle By Larry Wen
@Wentasy 博文仅供参考,欢迎大家来访。如有错误之处,希望批评指正。原创博文如需转载请注明出处,谢谢 :) [CSDN博客]
- 磁盘管理——RAID 5
- 磁盘管理——RAID 0
- 磁盘管理——RAID 1
- 磁盘管理——RAID 10
- 磁盘管理——RAID 6
- 磁盘管理四之RAID
- 磁盘管理之软RAID!
- 磁盘管理4--磁盘阵列RAID
- 每天进步一点点——Linux磁盘管理之LVM与RAID
- 磁盘存储:RAID 0、RAID 1、RAID 5、RAID 10
- RAID磁盘阵列和LVM磁盘管理
- Linux—管理磁盘
- 应用Btrfs管理磁盘,应用mdadm管理磁盘(softraid),使用raid卡管理磁盘
- 磁盘冗余阵列(RAID)——软件磁盘阵列应用
- 磁盘raid
- windows 磁盘管理:简单卷、跨区卷、带区卷、镜像卷 和 RAID-5
- Linux磁盘管理之LVM及RAID管理二之RAID管理
- Linux磁盘管理二(磁盘加密、磁盘配额(quota)、raid 磁盘阵列)
- winform Combox绑定数据并根据value值选中项
- HDU 2276 Kiki & Little Kiki 2 矩阵快速幂
- 文件读写字符乱码的解决方案
- ORMLite使用教程
- 二叉搜索树的详解(算法导论读书笔记)
- 磁盘管理——RAID 5
- [Oracle] 分区探索(1) - 分区剪枝
- ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 的解决方法
- android图片延迟加载,照片墙,listview中图片的延迟加载(国外制造)
- 创建高性能移动 web 站点
- eclipse工具使用
- struts2学习过程
- 禁止右键,左键,复制,粘贴
- 矩阵快速幂模版