Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): # 默认
First sector (2048-20971519, default 2048): #默认
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G # 添加1G
Partition 1 of type Linux and of size 1 GiB is set
操作同上共分了四个区 /dev/sdb{1,2,3,4} 当做四块硬盘使用
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0e220a08
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 8390655 1048576 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[iyunv@localhost ~]# fdisk /dev/sdc # 分区模拟出4块硬盘
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G
Partition 1 of type Linux and of size 1 GiB is set
同上 分四个区 /dev/sdc{1,2,3,4} 当做4块硬盘使用
Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 83 Linux
/dev/sdc2 2099200 4196351 1048576 83 Linux
/dev/sdc3 4196352 6293503 1048576 83 Linux
/dev/sdc4 6293504 8390655 1048576 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[iyunv@localhost ~]# ls /dev/sd*
/dev/sda /dev/sda2 /dev/sdb1 /dev/sdb3 /dev/sdc /dev/sdc2 /dev/sdc4
/dev/sda1 /dev/sdb /dev/sdb2 /dev/sdb4 /dev/sdc1 /dev/sdc3
[iyunv@localhost ~]# mdadm -C /dev/md5 -l 5 -n 3 -x 1 /dev/sdb{1,2,3,4} # 创建raid 5
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[iyunv@localhost ~]# mdadm -D /dev/md5
/dev/md5:
Version : 1.2
Creation Time : Sun Jun 19 21:00:53 2016
Raid Level : raid5
Array Size : 2095104 (2046.34 MiB 2145.39 MB)
Used Dev Size : 1047552 (1023.17 MiB 1072.69 MB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Sun Jun 19 21:00:59 2016
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Name : localhost.localdomain:5 (local to host localhost.localdomain)
UUID : 467e61c9:1ddfd1c6:51c27a22:bb7d160c
Events : 18
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 18 1 active sync /dev/sdb2
4 8 19 2 active sync /dev/sdb3
3 8 20 - spare /dev/sdb4
[iyunv@localhost ~]# ls /dev/md*
/dev/md5
[iyunv@localhost ~]# fdisk /dev/md5
Device Boot Start End Blocks Id System
/dev/md5p1 2048 2099199 1048576 83 Linux
/dev/md5p2 2099200 4190207 1045504 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.