Creating RAID 10 with mdadm on Linux (How to create RAID 10?)
| F.A.Q.Creating RAID 10 with mdadm on Linux
1. Load the modules
modprobe raid1 raid10
2. Create partitions
fdisk /dev/nvme0n1
Set the partition type to FD (Linux RAID autodetect).
3. Copy partition layout to other disks
sfdisk -d /dev/nvme0n1 | sfdisk --force /dev/nvme1n1
sfdisk -d /dev/nvme0n1 | sfdisk --force /dev/nvme2n1
sfdisk -d /dev/nvme0n1 | sfdisk --force /dev/nvme3n1
4. Create RAID 1
mdadm --create /dev/md0 --run --level=1 --raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1
mdadm --create /dev/md1 --run --level=1 --raid-devices=2 /dev/nvme2n1p1 /dev/nvme3n1p1
5. Create RAID 1+0
sudo mdadm --create /dev/md2 --run --level=0 --chunk=64 --raid-devices=2 /dev/md0 /dev/md1
6. Create a filesystem on RAID 10
mkfs.xfs /dev/md2
7. Edit /etc/mdadm.conf
Add the following entries:
DEVICE containers partitions
ARRAY /dev/md0 UUID=UUID
ARRAY /dev/md1 UUID=UUID
ARRAY /dev/md2 UUID=UUID
8. Find UUIDs
mdadm -D /dev/md0 | grep UUID
mdadm -D /dev/md1 | grep UUID
mdadm -D /dev/md2 | grep UUID
9. Edit /etc/fstab
/dev/md2 /mnt xfs defaults 1 2
10. Mount the RAID device
mount /mnt
Related Pages:
- Tools - TestDisk (Partition table recovery)
- RAID Types 0, 1, 5, 6, 10, 50, 60 & RAID Calculator (What RAID level to choose for a server?)
- RAID Settings impact on Performance (How to improve RAID performance?)(RAID Settings)
- Other factors affecting RAID performance (RAID Settings)