User Tools

Site Tools


linux:softraid

Create

mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1 --spare-devices=1 /dev/sdd1

Status

watch -n 1 'cat /proc/mdstat'
mdadm --detail /dev/md0
mdadm -E /dev/sdb2

Manage

mdadm --manage /dev/md1 --fail /dev/sdb2
mdadm --manage /dev/md1 --remove /dev/sdb2
mdadm --manage /dev/md1 --add /dev/sdb2

mdadm --grow /dev/md0 --raid-devices=4 // add drive
mdadm --grow /dev/md0 --size=max // change drive size

Test

mdadm --manage --set-faulty /dev/md1 /dev/sdc2

Scrubbing

echo "check" > /sys/block/md0/md/sync_action
echo "repair" > /sys/block/md0/md/sync_action
cat /sys/block/md0/md/mismatch_cnt

/etc/mdadm/mdadm.conf

MAILADDR mail@example.com,root@localhost
PROGRAM /root/script.sh
mdadm --detail --scan >>/etc/mdadm/mdadm.conf
update-initramfs -u

/etc/default/smartmontools

start_smartd=yes

RAID-5 Parity

On last disk by default

Reconstruct partition on new device

sfdisk -d /dev/sda > sda_partition.txt
sfdisk --force /dev/sdb < sda_partition.txt

Speed up resync

iostat -m
echo 20000 > /proc/sys/dev/raid/speed_limit_min
echo 90000 > /proc/sys/dev/raid/speed_limit_max

20000K/sec

Set SCT ERC

smartctl -l scterc,70,70 /dev/sda
linux/softraid.txt · Last modified: 2021/06/10 11:29 by Jan Forman