MDADM创建软RIAD
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MDADM创建软RIAD相关的知识,希望对你有一定的参考价值。
1.对磁盘进行分区,分区类型为fd.(fdisk /dev/sdb )
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00050060
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ fd Linux raid autodetect
/dev/sdb2 655 1308 5253255 fd Linux raid autodetect
/dev/sdb3 1309 1962 5253255 fd Linux raid autodetect
/dev/sdb4 1963 2355 3156772+ fd Linux raid autodetect
2.用mdadm创建riad.
mdadm -C /dev/md0 -l 5 -n 3 -x 1 /dev/sdb{1,2,3,4}
-C 创建模式
-l riad模式
-n 创建raid的设备数量
-x 空闲设备数量
查看创建好的raid
[[email protected] ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb3[4] sdb4[3](S) sdb2[1] sdb1[0]
10498048 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
3.创建文件系统
mkfs.ext4 /dev/md0
[[email protected] ~]# blkid /dev/md0
/dev/md0: UUID="1e839796-01a6-4635-bef4-f1cbad3097d4" TYPE="ext4"
4.挂载到目录使用
mount /dev/md0 /mnt
[[email protected] ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/md0 on /mnt type ext4 (rw)
!如果需要开机自动挂载的话需要修改/etc/fstab
5.人为损坏一块硬盘查看备份盘是否会替换损坏的盘。
mdadm -f /dev/md0 /dev/sdb2
[[email protected] ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Tue Dec 27 05:11:20 2016
Raid Level : raid5
Array Size : 10498048 (10.01 GiB 10.75 GB)
Used Dev Size : 5249024 (5.01 GiB 5.38 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Tue Dec 27 05:48:06 2016
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Name : bogon:0 (local to host bogon)
UUID : 2f52c38f:0e9eb247:d8a6537c:dc76facf
Events : 39
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
3 8 20 1 active sync /dev/sdb4
4 8 19 2 active sync /dev/sdb3
5 8 18 - spare /dev/sdb2
6.添加一块新的盘作为备份盘
mdadm -a /dev/md0 /dev/sdb2
本文出自 “生命不息折腾到底” 博客,谢绝转载!
以上是关于MDADM创建软RIAD的主要内容,如果未能解决你的问题,请参考以下文章