Mdadm

In case the mdadm raid is somehow lost or if you move your hard-drives to another computer, you might have to “re-create” the raid array.

First, mdadm stores it's configuration on each drive, so let's try to have mdadm automatically find the array back by itself :

mdadm --examine --scan

It should show the HDDs participating in the array, if it's the case, try to have mdadm automatically start the array :

mdadm --assemble --examine -v

If for some reason some HDDs appear out of sync in the output of the previous command, there is one last chance. For this, you must be sure that the array was clean the last time it was disconnected ! First stop the (failed) array created earlier :

mdadm --stop /dev/md0

Then force-create the array :

mdadm --create --force /dev/md0 /dev/sd[acd]1

This should do the trick, if not, search the internet for more ideas…

Tip #1: /proc/sys/dev/raid/{speed_limit_max,speed_limit_min} kernel variables

This tip is not very efficient on my setup.

### Display the current values : ###
sysctl dev.raid.speed_limit_min
sysctl dev.raid.speed_limit_max
 
### Modify them : ###
sysctl -w dev.raid.speed_limit_min=1000
sysctl -w dev.raid.speed_limit_max=200000

Tip #2: Set read-ahead option

This tip is very efficient on my setup.

### Set read-ahead to 32 MiB ###
blockdev --setra 65536 /dev/md0

Tip #3: Set stripe-cache_size for RAID5 or RAID 6

echo 32768 > /sys/block/md0/md/stripe_cache_size

Tip #4: Disable NCQ on all disks

This tip is not useful since NCQ (Native Command Queing) is not supported by my hardware…

for i in sd[[abcde]]
do
  echo 1 > /sys/block/$i/device/queue_depth
done

Tip #5: Bitmap Option

This tip does not work when the array is already in resync state !

### To enable it : ###
mdadm --grow --bitmap=internal /dev/md0
 
### Once complete, to disable it : ###
mdadm --grow --bitmap=none /dev/md0

(Source : http://www.cyberciti.biz/tips/linux-raid-increase-resync-rebuild-speed.html)

  • ubuntu/mdadm.txt
  • Dernière modification : 2018-Sep-18 22:39
  • de 127.0.0.1