Linux下直接创建RAID 10

前面有一个在创建RAID 10的实验中,是先创建RAID 0,再创建RAID 1,这样组成了,其实,也可以直接创建RAID 10
[root@kpcenter ~]# fdisk -l /dev/sda
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         123      987966   83  Linux
/dev/sda2             124         246      987997+  83  Linux
/dev/sda3             247         369      987997+  83  Linux
/dev/sda4             370        2610    18000832+   5  Extended
/dev/sda5             370         492      987966   83  Linux
/dev/sda6             493         615      987966   83  Linux
/dev/sda7             616         738      987966   83  Linux

创建RAID 10时,直接指定级别为10,阵列中的sda[1-3,5]是成员磁盘,sda6作为一个spare disk
[root@kpcenter ~]# mdadm -C /dev/md10 -l10 -n4 /dev/sda[1-3,5] -x1 /dev/sda6
mdadm: /dev/sda1 appears to contain an ext2fs file system
   size=1975680K  mtime=Sat May  4 12:51:56 2013
mdadm: /dev/sda3 appears to contain an ext2fs file system
   size=1975680K  mtime=Sat May  4 12:51:56 2013
Continue creating array? y
mdadm: array /dev/md10 started.

正在创建中:
[root@kpcenter ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid1] [raid10]
md10 : active raid10 sda6[4](S) sda5[3] sda3[2] sda2[1] sda1[0]
     1975680 blocks 64K chunks 2 near-copies [4/4] [UUUU]
     [============>........]  resync = 62.2% (1229824/1975680) finish=0.2min speed=51242K/sec
unused devices: <none>
创建完成,检查:
[root@kpcenter ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid1] [raid10]
md10 : active raid10 sda6[4](S) sda5[3] sda3[2] sda2[1] sda1[0]
     1975680 blocks 64K chunks 2 near-copies [4/4] [UUUU]
unused devices: <none>

新建文件系统:
[root@kpcenter ~]# mkfs.ext3 /dev/md10
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
247296 inodes, 493920 blocks
24696 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=507510784
16 block groups
32768 blocks per group, 32768 fragments per group
15456 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 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

创建挂载点并挂载使用:
[root@kpcenter ~]# mkdir /mnt/raid10
[root@kpcenter ~]# mount /dev/md10 /mnt/raid10/
[root@kpcenter ~]# ll /mnt/raid10/
total 16
drwx------ 2 root root 16384 May  4 18:16 lost+found

[root@kpcenter ~]# df -hT | grep md
/dev/md10     ext3    1.9G   35M  1.8G   2% /mnt/raid10

添加该阵列的相关信息到/etc/mdadm.conf配置文件中:
[root@kpcenter ~]# mdadm -Ds >> /etc/mdadm.conf

添加的阵列信息类似于下面(排版问题,实际都在一行里):
[root@kpcenter ~]# sed -n '$p' /etc/mdadm.conf
ARRAY /dev/md10 level=raid10 num-devices=4 metadata=0.90 spares=1 UUID=b5c9885f:1f55009a:93dc5b71:f0a1c245

如果要开机自动挂载,在/etc/fstab添加挂载信息:
[root@kpcenter ~]# blkid /dev/md10
/dev/md10: UUID="e9cbb951-8a3d-4ae5-942e-d0038640d955" SEC_TYPE="ext2" TYPE="ext3"
添加的挂载信息类似于下面:
[root@kpcenter ~]# sed -n '$p' /etc/fstab
UUID="e9cbb951-8a3d-4ae5-942e-d0038640d955" /mnt/raid10 ext3 defaults0 0


你可能感兴趣的:(linux)