Quotidien Shaarli
05/22/23
Useful RAID commands :
# Conf mdadm
cat /etc/mdadm.conf
# Current md stats
cat /proc/mdstat
# detail on a MD device :
mdadm --query --detail /dev/md3
# detail on partition
mdadm --examine /dev/sda3
Complete with OVH RAID help
# Copy partition table from safe disk to new disk (for GPT partition - see fdisk -l)
sgdisk -R /dev/newdisk /dev/safedisk
# afterwards, you have to randomize the GUID on the new hard disk to ensure that they are unique (from [howto forge](https://www.howtoforge.com/tutorial/linux-raid-replace-failed-harddisk/))
sgdisk -G /dev/sdb
# check partitions are copied
sgdisk -p /dev/safedisk
sgdisk -p /dev/newdisk
# Add each partition to RAID cluster :
mdadm --manage /dev/mdX2 --add /dev/newdiskX2
mdadm --manage /dev/mdX1 --add /dev/newdiskX1
# follow reconstruction with
mdam --detail /dev/mdX
or
cat /proc/mdstat
# Rebuild Status : 21% complete