ソフトウェアRAID手動構築

i=sdc; parted --script /dev/$i 'mklabel gpt'; parted --script /dev/$i 'mkpart primary 2048s -1'; parted --script /dev/$i 'set 1 raid on'
i=sdd; parted --script /dev/$i 'mklabel gpt'; parted --script /dev/$i 'mkpart primary 2048s -1'; parted --script /dev/$i 'set 1 raid on'
i=sde; parted --script /dev/$i 'mklabel gpt'; parted --script /dev/$i 'mkpart primary 2048s -1'; parted --script /dev/$i 'set 1 raid on'

mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/disk/by-id/ata-ST3000DM001-9YN166_S1F0KGPN-part1 /dev/disk/by-id/ata-ST3000DM001-9YN166_W1F0QVCA-part1 /dev/disk/by-id/ata-ST3000DM001-9YN166_S1F0NG91-part1

cat /proc/mdstat
#で状況確認

mkfs.ext4 /dev/md0
mkdir /data
echo "/dev/md0  /data  ext4  defaults  0  0" >> /etc/fstab
mount -a
#mount /dev/md0 /data

echo "DEVICE /dev/disk/by-id/ata-ST3000DM001-9YN166_S1F0KGPN-part1 /dev/disk/by-id/ata-ST3000DM001-9YN166_W1F0QVCA-part1 /dev/disk/by-id/ata-ST3000DM001-9YN166_S1F0NG91-part1" > /etc/mdadm.conf

mdadm --detail --scan >> /etc/mdadm.conf
echo MAILADDR akyoshita@g.ecc.u-tokyo.ac.jp >> /etc/mdadm.conf

systemctl start mdmonitor
systemctl enable mdmonitor