Partition number (1-8): 6
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)
Partition number (1-8): 7
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdb1 1 2610 20964793+ 5 Extended
/dev/sdb5 1 13 104359+ fd Linux raid autodetect
/dev/sdb6 14 26 104391 fd Linux raid autodetect
/dev/sdb7 27 39 104391 fd Linux raid autodetect
/dev/sdb8 40 52 104391 fd Linux raid autodetect
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sda1 * 1 3916 31455238+ 83 Linux
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdb1 1 2610 20964793+ 5 Extended
/dev/sdb5 1 13 104359+ fd Linux raid autodetect
/dev/sdb6 14 26 104391 fd Linux raid autodetect
/dev/sdb7 27 39 104391 fd Linux raid autodetect
/dev/sdb8 40 52 104391 fd Linux raid autodetect
-C 创建
cat mdadm: array /dev/md0 started.
[root@zhaoyun ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb7[2] sdb8[3](S) sdb6[1] sdb5[0]
208512 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>
[root@zhaoyun ~]# mdadm -D /dev/md0
/dev/md0:
Version : 0.90
Creation Time : Tue Nov 29 09:39:50 2011
Raid Level : raid5
Array Size : 208512 (203.66 MiB 213.52 MB)
Used Dev Size : 104256 (101.83 MiB 106.76 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Chunk Size : 64K
Events : 0.2
0 8 21 0 active sync /dev/sdb5
1 8 22 1 active sync /dev/sdb6
2 8 23 2 active sync /dev/sdb7
[root@zhaoyun ~]# cd /mnt
[root@zhaoyun mnt]# ls
lost+found
[root@zhaoyun mnt]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 30G 3.1G 25G 12% /
tmpfs 95M 0 95M 0% /dev/shm
/dev/hdc 2.8G 2.8G 0 100% /media
/dev/md0 198M 5.8M 182M 4% /mnt
[root@zhaoyun mnt]# touch file
[root@zhaoyun mnt]# ls
file lost+found
[root@zhaoyun mnt]#
[root@zhaoyun ~]# cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid5 num-devices=3 metadata=0.90 spares=2 UUID=68f3eb1f:adeffa6b:bd57a6e6:436b9c07
[root@zhaoyun ~]#
mdadm: set /dev/sdb5 faulty in /dev/md0
[root@zhaoyun ~]# mdadm -D /dev/md0
/dev/md0:
Version : 0.90
Creation Time : Tue Nov 29 09:44:47 2011
Raid Level : raid5
Array Size : 208512 (203.66 MiB 213.52 MB)
Used Dev Size : 104256 (101.83 MiB 106.76 MB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 4
Failed Devices : 1
Spare Devices : 2
Chunk Size : 64K
Events : 0.8
3 8 24 0 spare rebuilding /dev/sdb8 #将热备的硬盘加入到raid中,必经过的状态
1 8 22 1 active sync /dev/sdb6
2 8 23 2 active sync /dev/sdb7
5 8 21 - faulty spare /dev/sdb5 #顺坏硬盘的状态
[root@zhaoyun ~]# mdadm -D /dev/md0
/dev/md0:
Version : 0.90
Creation Time : Tue Nov 29 09:44:47 2011
Raid Level : raid5
Array Size : 208512 (203.66 MiB 213.52 MB)
Used Dev Size : 104256 (101.83 MiB 106.76 MB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 1
Spare Devices : 1
Chunk Size : 64K
Events : 0.10
0 8 24 0 active sync /dev/sdb8 #重建完成后的状态。
1 8 22 1 active sync /dev/sdb6
2 8 23 2 active sync /dev/sdb7
4 8 21 - faulty spare /dev/sdb5
[root@zhaoyun ~]#