ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux的软RAID

Linux的软RAID

原创 Linux操作系统 作者:byfree 时间:2008-04-23 14:08:37 0 删除 编辑

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.9-55.EL #1 Fri Apr 20 16:35:59 EDT 2007 i686 i686 i386 GNU/Linux
1.查看是否已有mdadm包:
[root@localhost ~]# rpm -qa|grep mdadm
mdadm-1.12.0-2

2.准备足够用的盘或LV
准备好后可通过cat /proc/partitions查看
[root@localhost ~]# cat /proc/partitions
major minor  #blocks  name

   3     0   78149687 hda
   3     1     104391 hda1
   3     2   78043770 hda2
  22     0   39082680 hdc
  22     1   16064968 hdc1
  22     2   23013112 hdc2
 253     0   76972032 dm-0
 253     1    1015808 dm-1
 253     2    5242880 dm-2
 253     3    5242880 dm-3
 253     4    5242880 dm-4
 253     5    5242880 dm-5
此处dm-2,dm-3,dm-4,dm-5为测试用的LV,大小均为5G

3.创建RAID1
[root@localhost /]# mdadm -C /dev/md0 -l1 -n2 /dev/vg01/lv{0,1}
mdadm: /dev/vg01/lv0 appears to contain an ext2fs file system
    size=20971392K  mtime=Wed Apr 23 11:06:43 2008
mdadm: /dev/vg01/lv1 appears to contain an ext2fs file system
    size=20971392K  mtime=Wed Apr 23 11:06:43 2008
Continue creating array?    
Continue creating array? (y/n) y
mdadm: array /dev/md0 started.
命令中:-l1表示创建raid1,-n2表示两个设备,最后是两个LV的具体路径。

查看raid配置信息:
[root@localhost /]# cat /proc/mdstat
md0 : active raid1 dm-3[1] dm-2[0]
      5242816 blocks [2/2] [UU]
      [=>...................]  resync =  6.3% (334720/5242816) finish=29.4min speed=2778K/sec

创建第二组RAID1:     
[root@localhost /]# mdadm -C /dev/md1 -l1 -n2 /dev/vg01/lv{2,3}
mdadm: /dev/vg01/lv3 appears to be part of a raid array:
    level=0 devices=2 ctime=Wed Apr 23 13:09:40 2008
Continue creating array? y
mdadm: array /dev/md1 started.

4.创建RAID10
[root@localhost /]# mdadm -C /dev/md2 -l0 -n2 /dev/md{0,1}
mdadm: /dev/md0 appears to contain an ext2fs file system
    size=20971392K  mtime=Wed Apr 23 11:06:43 2008
Continue creating array? y
mdadm: array /dev/md2 started.

查看raid配置信息:
[root@localhost /]# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
md2 : active raid0 md1[1] md0[0]
      10485504 blocks 64k chunks
     
md1 : active raid1 dm-5[1] dm-4[0]
      5242816 blocks [2/2] [UU]
      [>....................]  resync =  2.8% (151424/5242816) finish=31.0min speed=2732K/sec
md0 : active raid1 dm-3[1] dm-2[0]
      5242816 blocks [2/2] [UU]
      [=>...................]  resync =  6.3% (334720/5242816) finish=29.4min speed=2778K/sec
unused devices:

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17997/viewspace-249091/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: windows iscsi客户端
请登录后发表评论 登录
全部评论

注册时间:2008-04-16

  • 博文量
    65
  • 访问量
    232611