手机版
你好,游客 登录 注册
背景:
阅读新闻

VMware Workstation 8.0 RHEL5.6 mdadm 实现软RAID5

[日期:2012-12-23] 来源:Linux社区  作者:totozlj [字体:大 中 小]
5、将分区信息写入内核
 
[root@rhel5 ~]#partprobe
 
在这里首先需要将光驱弹出
 
6、查看硬盘信息
 
[root@rhel5 ~]# cat /proc/partitions
major minor #blocks name
 
8 0 31457280 sda
 8 1 104391 sda1
 8 2 10482412 sda2
 8 3 2096482 sda3
 8 4 0 sda4
 8 5 18771921 sda5
 8 16 5242880 sdb
 8 17 5237158 sdb1
 8 32 5242880 sdc
 8 33 5237158 sdc1
 8 48 5242880 sdd
 8 49 5237158 sdd1
 8 64 5242880 sde
 8 65 5237158 sde1
 
7、创建RAID采用create选项(可以先使用mdadm --help熟悉下mdadm的选项和参数),查看帮助
 
[root@rhel5 ~]#mdadm --create --help
Usage: mdadm --create device -chunk=X --level=Y --raid-devices=Z devices
 
This usage will initialise a new md array, associate some
 devices with it, and activate the array. In order to create an
 array with some devices missing, use the special word 'missing' in
 place of the relevant device name.
 
Before devices are added, they are checked to see if they already contain
 raid superblocks or filesystems. They are also checked to see if
 the variance in device size exceeds 1%.
 If any discrepancy is found, the user will be prompted for confirmation
 before the array is created. The presence of a '--run' can override this
 caution.
 
If the --size option is given then only that many kilobytes of each
 device is used, no matter how big each device is.
 If no --size is given, the apparent size of the smallest drive given
 is used for raid level 1 and greater, and the full device is used for
 other levels.
 
Options that are valid with --create (-C) are:
--bitmap= : Create a bitmap for the array with the given filename
--chunk= -c : chunk size of kibibytes
--rounding= : rounding factor for linear array (==chunk size)
--level= -l : raid level: 0,1,4,5,6,linear,multipath and synonyms
--parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric
--layout= : same as --parity
--raid-devices= -n : number of active devices in array
--spare-devices= -x: number of spares (eXtras) devices in initial array
--size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional
--force -f : Honour devices as listed on command line. Don't
 : insert a missing drive for RAID5.
--run -R : insist of running the array even if not all
 : devices are present or some look odd.
--readonly -o : start the array readonly - not supported yet.
--name= -N : Textual name for array - max 32 characters
--bitmap-chunk= : bitmap chunksize in Kilobytes.
--delay= -d : bitmap update delay in seconds.
 
8、接下来我们使用mdadm创建在/dev/md0上创建一个由sdb、sdc、sdd3块盘组成(另外1块盘sde为热备)的RAID5
 
[root@rhel5 ~]#mdadm --create --verbose /dev/md0 --level=raid5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd --spare-devices=1 /dev/sde
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 5242816K
mdadm: array /dev/md0 started.
 
可以看到大部分选项都有简写形式,使用下面的指令创建RAID,指令可以解释为:
 
-Cv 创建RAID并输出详细信息
 
/dev/md0 RAID的设备名
 
-l5 level5即RAID5
 
-n3 3块激活磁盘/dev/sdb /dev/sdc /dev/sdd
 
-x1 1块备份盘/dev/sde
 
9、查看创建RAID的结果,可以看到你的RAID的一些信息。
 
接下来我们使用cat /proc/mdstat命令来查看一下RAID的状态,我们也可以利用watch命令来每隔一段时间刷新/proc/mdstat的输出。使用CTRL+C可以取消。
 
[root@rhel5 ~]#watch -n 10 'cat /proc/mdstat'
 
Every 10.0s: cat /proc/mdstat Mon Nov 12 11:57:41 2012
 
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd[2] sde[3](S) sdc[1] sdb[0]
 10485632 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
 
unused devices: <none>linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款