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

Test

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

Scrubbing

echo "check" > /sys/block/md0/md/sync_action

/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

linux/softraid.txt · Last modified: 2017/09/19 14:12 by Jan Forman