2018年10月5日 星期五

software raid on RHEL7.5

review disk layout
parted /dev/sdx u s p

raid creation process
1: create 2x type code 0xfd partitions

2: set raid flag to all partitions
parted /dev/sdx set 1 raid on

3: set boot flag to partition which serves for grub configuration files
parted /dev/sdx set 1 boot on

4: zero out superblock
mdadm --zero-superblock /dev/sdx[1-9]

5: create raid
mdadm --create /dev/md0 --name=root -n2 -l1 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --name=root -n2 -l1 /dev/sda2 /dev/sdb2

6: delete raid
mdadm --delete /dev/md0
mdadm --zero-superblock /dev/sdx[1-9]
mdadm --stop /dev/md0

6: repair raid
mdadm --add /dev/md0 /dev/sda1

7:scan available md
mdadm --examine --scan
mdadm --examine /dev/sdx[1-9]

8: raid uuid - this information need to be included in /etc/default/grub
mdadm --detail /dev/md0|grep UUID
rd.md.uuid=xxxx

9: activate software raid
mdadm -A -R /dev/md0 /dev/sda1 /dev/sdb1

others:
don't forget to creating new initramfs
dracut -f --mdadmconf

to install grub2 on a drive. mdadm package needs to be installed first and grub needs to be installed to whole disk drive instead of partition. grub needs to be installed on both drives
grub2-install --no-floppy --boot-directory=/boot /dev/sda

沒有留言: