1、主要性能排序:
    冗余从好到坏:raid 1 raid 10 raid 5 raid 0
    性能从好到坏:raid 0 raid 10 raid 5 raid 1
    成本从低到高:raid 0 raid 5 raid 1 raid 10
    image.png
    image.png
    操作步骤
    一: 划分磁盘(磁盘分区)

    1. [root@linux001 ~]# fdisk /dev/sdb
    2. Welcome to fdisk (util-linux 2.23.2).
    3. Changes will remain in memory only, until you decide to write them.
    4. Be careful before using the write command.
    5. Command (m for help): n
    6. Partition type:
    7. p primary (0 primary, 0 extended, 4 free)
    8. e extended
    9. Select (default p): p
    10. Partition number (1-4, default 1):
    11. First sector (2048-41943039, default 2048):
    12. Using default value 2048
    13. Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +200M
    14. Partition 1 of type Linux and of size 200 MiB is set
    15. Command (m for help): t #修改文件格式为fd
    16. Selected partition 1
    17. Hex code (type L to list all codes): fd
    18. Changed type of partition 'Linux' to 'Linux raid autodetect'
    19. Command (m for help): p
    20. Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
    21. Units = sectors of 1 * 512 = 512 bytes
    22. Sector size (logical/physical): 512 bytes / 512 bytes
    23. I/O size (minimum/optimal): 512 bytes / 512 bytes
    24. Disk label type: dos
    25. Disk identifier: 0x0bf1ea4a
    26. Device Boot Start End Blocks Id System
    27. /dev/sdb1 2048 411647 204800 fd Linux raid autodetect
    28. Command (m for help): w
    29. The partition table has been altered!
    30. Calling ioctl() to re-read partition table.
    31. Syncing disks.

    使用同样的方法创建其他3个硬盘分区

    1. [root@linux001 ~]# fdisk -l (以去除无用信息)
    2. Device Boot Start End Blocks Id System
    3. /dev/sdb1 2048 411647 204800 fd Linux raid autodetect
    4. /dev/sdc1 2048 411647 204800 fd Linux raid autodetect
    5. /dev/sdd1 2048 411647 204800 fd Linux raid autodetect
    6. /dev/sde1 2048 411647 204800 fd Linux raid autodetect

    二: 使用mdadm命令创建RAID5
    RAID的设备名称为/dev/mdx ,其中X为序列号从0开始

    1. [root@linux001 ~]# mdadm --create --help #使用mdadm命令,--help有参考