Why?


Search This Blog

Saturday, August 6, 2016

CentOS 7 build mdadm raid10 or raid0

CentOS 7 build mdadm raid10 or raid0

I have 8 3TB WD Red SATA drives for this array. sdb through sdi.

My boot and OS drive is a an 850 EVO SSD on sda.

The 8 WD drives are on a Supermicro AOC-SAS2LP-MV8 Add-on Card, 8-Channel SAS/SATA Adapter with 600MB/s per Channel in a PCIE x16 running at x8 on a Supermicro ATX DDR4 LGA 1151 C7Z170-OCE-O Motherboard

Prepping drives for new partion by removeing old stuff

NOTE** If you have drives from an array you will more than likely need to remove the super block from them.

NOTE** mdadm must be installed to remove superblock.

mdadm --stop /dev/md0
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdc1
mdadm --zero-superblock /dev/sdd1
mdadm --zero-superblock /dev/sde1
mdadm --zero-superblock /dev/sdf1
mdadm --zero-superblock /dev/sdg1
mdadm --zero-superblock /dev/sdh1
mdadm --zero-superblock /dev/sdi1


wipefs -a /dev/sdb
wipefs -a /dev/sdc
wipefs -a /dev/sdd
wipefs -a /dev/sde
wipefs -a /dev/sdf
wipefs -a /dev/sdg
wipefs -a /dev/sdh
wipefs -a /dev/sdi


**END of NOTE

dd if=/dev/zero of=/dev/sdb bs=1024 count=1024
dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
dd if=/dev/zero of=/dev/sdd bs=1024 count=1024
dd if=/dev/zero of=/dev/sde bs=1024 count=1024
dd if=/dev/zero of=/dev/sdf bs=1024 count=1024
dd if=/dev/zero of=/dev/sdg bs=1024 count=1024
dd if=/dev/zero of=/dev/sdh bs=1024 count=1024
dd if=/dev/zero of=/dev/sdi bs=1024 count=1024


reboot

ls -lsa /dev/sd*
0 brw-rw---- 1 root disk 8,   0 Aug  6 19:26 /dev/sda
0 brw-rw---- 1 root disk 8,   1 Aug  6 19:26 /dev/sda1
0 brw-rw---- 1 root disk 8,   2 Aug  6 19:26 /dev/sda2
0 brw-rw---- 1 root disk 8,   3 Aug  6 19:26 /dev/sda3
0 brw-rw---- 1 root disk 8,  16 Aug  6 19:26 /dev/sdb
0 brw-rw---- 1 root disk 8,  32 Aug  6 19:26 /dev/sdc
0 brw-rw---- 1 root disk 8,  48 Aug  6 19:26 /dev/sdd
0 brw-rw---- 1 root disk 8,  64 Aug  6 19:26 /dev/sde
0 brw-rw---- 1 root disk 8,  80 Aug  6 19:26 /dev/sdf
0 brw-rw---- 1 root disk 8,  96 Aug  6 19:26 /dev/sdg
0 brw-rw---- 1 root disk 8, 112 Aug  6 19:26 /dev/sdh
0 brw-rw---- 1 root disk 8, 128 Aug  6 19:26 /dev/sdi



fdisk -l should show non partion drives for sdb through sdi

Installing mdadm

yum clean all && yum update

Verify Attached Drives

ls -l /dev | grep sd

mdadm --examine /dev/sd[b-i]

Creating Partitions for RAID. Do this for all 8 drives

parted /dev/sdb
mklabel gpt
yes
unit TB
mkpart primary 0.00TB 3.00TB
print
quit


[root@nas ~]# ls -lsa /dev/sd*
0 brw-rw---- 1 root disk 8,   0 Aug  6 19:26 /dev/sda
0 brw-rw---- 1 root disk 8,   1 Aug  6 19:26 /dev/sda1
0 brw-rw---- 1 root disk 8,   2 Aug  6 19:26 /dev/sda2
0 brw-rw---- 1 root disk 8,   3 Aug  6 19:26 /dev/sda3
0 brw-rw---- 1 root disk 8,  16 Aug  6 19:35 /dev/sdb
0 brw-rw---- 1 root disk 8,  17 Aug  6 19:35 /dev/sdb1
0 brw-rw---- 1 root disk 8,  32 Aug  6 19:36 /dev/sdc
0 brw-rw---- 1 root disk 8,  33 Aug  6 19:36 /dev/sdc1
0 brw-rw---- 1 root disk 8,  48 Aug  6 19:37 /dev/sdd
0 brw-rw---- 1 root disk 8,  49 Aug  6 19:37 /dev/sdd1
0 brw-rw---- 1 root disk 8,  64 Aug  6 19:37 /dev/sde
0 brw-rw---- 1 root disk 8,  65 Aug  6 19:37 /dev/sde1
0 brw-rw---- 1 root disk 8,  80 Aug  6 19:37 /dev/sdf
0 brw-rw---- 1 root disk 8,  81 Aug  6 19:37 /dev/sdf1
0 brw-rw---- 1 root disk 8,  96 Aug  6 19:37 /dev/sdg
0 brw-rw---- 1 root disk 8,  97 Aug  6 19:37 /dev/sdg1
0 brw-rw---- 1 root disk 8, 112 Aug  6 19:37 /dev/sdh
0 brw-rw---- 1 root disk 8, 113 Aug  6 19:37 /dev/sdh1
0 brw-rw---- 1 root disk 8, 128 Aug  6 19:37 /dev/sdi
0 brw-rw---- 1 root disk 8, 129 Aug  6 19:37 /dev/sdi1




Exzamine drives

mdadm --examine /dev/sd[b-i]
mdadm --examine /dev/sd[b-i]1


Creating RAID array

mdadm --create /dev/md0 --level raid10 --raid-disks 8 /dev/sd[b-i]1

****NOTE use "--level=stripe" for raid0

Exzamine Array

cat /proc/mdstat

mdadm -E /dev/sd[b-i]1

mdadm --detail /dev/md0


Create file system

mkfs.ext4 /dev/md0

Mount Array

mkdir /myraid
mount /dev/md0 /myraid


Persistent mount on reboot

vi /etc/fstab
/dev/md0   /myraid   ext4    defaults   0 0


Check for fstab errors

mount -av

Saving RAID Configuration

mdadm -E -s -v >> /etc/mdadm.conf
mdadm --detail --scan --verbose >> /etc/mdadm.conf
cat /etc/mdadm.conf










No comments:

Post a Comment