Linux CentOS5.5 软RAID10 (二)配置成RAID10

一.用准备好的 四块磁盘创建 RAID10 
[root@localhost dev]#  mdadm --create  --auto=yes  /dev/md10 --level=10 --raid-devices=4  /dev/sdb1  /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm: /dev/sdb1 appears to contain an ext2fs file system
    size=2088128K  mtime=Wed Apr 20 01:39:41 2011
mdadm: /dev/sdb1 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Wed Apr 20 01:35:41 2011
mdadm: /dev/sdc1 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Wed Apr 20 01:35:41 2011
mdadm: /dev/sdd1 appears to contain an ext2fs file system
    size=2088128K  mtime=Wed Apr 20 01:39:41 2011
mdadm: /dev/sdd1 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Wed Apr 20 01:36:08 2011
mdadm: /dev/sde1 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Wed Apr 20 01:36:08 2011
Continue creating array? y
mdadm: array /dev/md10 started.

查看一下

[root@localhost dev]# cat /proc/mdstat
Personalities : [raid0] [raid10]
md10 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]
      2088192 blocks 64K chunks 2 near-copies [4/4] [UUUU]
      [=====>...............]  resync = 29.5% (618048/2088192) finish=0.4min speed=51504K/sec
     
unused devices: <none>

二.格式化刚创建好的raid10

[root@localhost dev]# mkfs -t ext3 /dev/md10
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
261120 inodes, 522048 blocks
26102 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                           
Creating journal (8192 blocks):
done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@localhost dev]#
[root@localhost dev]# cat /proc/mdstat
Personalities : [raid0] [raid10]
md10 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]
      2088192 blocks 64K chunks 2 near-copies [4/4] [UUUU]
      [================>....]  resync = 84.1% (1758144/2088192) finish=0.1min speed=30868K/sec
     
unused devices: <none>
三.挂载
[root@localhost dev]# mkdir /media/raid10
[root@localhost dev]# mount /dev/md10  /media/raid10
[root@localhost dev]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.8G  2.5G  1.2G  69% /
/dev/sda3             1.5G   87M  1.4G   6% /home
/dev/sda1              46M   11M   33M  25% /boot
tmpfs                 252M     0  252M   0% /dev/shm
/dev/md10             2.0G   36M  1.9G   2% /media/raid10

[root@localhost dev]# cat /proc/mdstat
Personalities : [raid0] [raid10]
md10 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]
      2088192 blocks 64K chunks 2 near-copies [4/4] [UUUU]
     
unused devices: <none>

 

四.查看

[root@localhost Desktop]# mdadm --detail /dev/md10
/dev/md10:
        Version : 0.90
  Creation Time : Wed Apr 20 04:46:22 2011
     Raid Level : raid10
     Array Size : 2088192 (2039.59 MiB 2138.31 MB)
  Used Dev Size : 1044096 (1019.80 MiB 1069.15 MB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 10
    Persistence : Superblock is persistent

    Update Time : Wed Apr 20 04:47:54 2011
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 64K

           UUID : d7457594:215c0367:6cd831d4:52469697
         Events : 0.4

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8       49        2      active sync   /dev/sdd1
       3       8       65        3      active sync   /dev/sde1

 

五.测试

[root@localhost Desktop]#  hdparm -tT /dev/md10

/dev/md10:
 Timing cached reads:   2368 MB in  1.99 seconds = 1189.65 MB/sec
 Timing buffered disk reads:  114 MB in  3.03 seconds =  37.63 MB/sec

 

也可以用 dd测试

 

六.设置开机自动启动RAID,并自动挂载

1.查看UUID号

[root@localhost ~]# mdadm --detail /dev/md10
/dev/md10:
        Version : 0.90
  Creation Time : Wed Apr 20 18:20:18 2011
     Raid Level : raid10
     Array Size : 2088192 (2039.59 MiB 2138.31 MB)
  Used Dev Size : 1044096 (1019.80 MiB 1069.15 MB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 10
    Persistence : Superblock is persistent

    Update Time : Wed Apr 20 18:21:39 2011
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 64K

           UUID : 090dea92:88bb3482:6a934b67:23713f28
         Events : 0.2

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8       49        2      active sync   /dev/sdd1
       3       8       65        3      active sync   /dev/sde1

2.添加UUID号到 /etc/mdadm.conf
[root@localhost ~]# vi /etc/mdadm.conf
[root@localhost ~]# more /etc/mdadm.conf
ARRAY /dev/md10  UUID=090dea92:88bb3482:6a934b67:23713f28


3.设置开机自动挂载

[root@localhost ~]# vi /etc/fstab
[root@localhost ~]# more /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda5         swap                    swap    defaults        0 0
/dev/md10               /media/raid10           ext3    defaults        1 2

 

4.查看挂载设备

[root@localhost ~]# ls /media
raid10
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.8G  2.5G  1.1G  70% /
/dev/sda3             1.5G   87M  1.4G   6% /home
/dev/sda1              46M   11M   33M  25% /boot
tmpfs                 252M     0  252M   0% /dev/shm
/dev/md10             2.0G   36M  1.9G   2% /media/raid10

 

参考    《鸟哥的Linux私房菜第三版》

            《Linux系统管理技术手册第二版》

 

声明:本文档可以随意更改,但必须署名原作者

作者:凤凰舞者 qq:578989855

你可能感兴趣的:(linux,centos,ext,layout,System,events)