TipsOnRaid10
Jun 25, 2019
Technology
Find how many disks are available in system:
# fdisk -l
Examine the detailed info:
# lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
NAME SIZE FSTYPE TYPE MOUNTPOINT
loop0 876.9M iso9660 loop /media/cdrom
sda 557.9G disk
├─sda1 512M vfat part /boot/efi
└─sda2 557.4G ext4 part /
sdb 3.7T disk
sdc 3.7T disk
sdd 3.7T disk
sde 3.7T disk
sdf 3.7T disk
sdg 3.7T disk
sdh 3.7T disk
sdi 3.7T disk
sdj 3.7T disk
sdk 3.7T disk
sdl 3.7T disk
sdm 3.7T disk
Create the raid10 using following command:
# mdadm --create --verbose /dev/md0 --level=10 --raid-devices=12 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm
View the status, now you could use it:
# cat /proc/mdstat
Make filesystem for using:
# mkfs.ext4 -F /dev/md0
Create mount point and mount the md0:
# mkdir -p /media/md0
# mount /dev/md0 /media/md0
# df -h
Add md items to mdadm configuration file, so next time bootup kernel will recognize it, also add fstab items:
# mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
# cat /etc/mdadm/mdadm.conf
# update-initramfs -u
# echo '/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
# cat /etc/fstab
Now view the lsblk output will show like following:
lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
NAME SIZE FSTYPE TYPE MOUNTPOINT
loop0 876.9M iso9660 loop /media/cdrom
sda 557.9G disk
├─sda1 512M vfat part /boot/efi
└─sda2 557.4G ext4 part /
sdb 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdc 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdd 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sde 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdf 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdg 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdh 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdi 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdj 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdk 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdl 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
sdm 3.7T linux_raid_member disk
└─md0 21.9T ext4 raid10 /media/md0
remove md
via:
sudo mdadm --stop /dev/md0
sudo mdadm --detail /dev/md0
sudo mdadm --zero-superblock /dev/sdx
sudo mv /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf.bak