Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mdadm [2022/09/30 04:39] – norman | mdadm [2025/10/02 12:05] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Mdadm Helpers ====== | ====== Mdadm Helpers ====== | ||
| + | |||
| + | ************* | ||
| + | |||
| + | ===== Debian Disable/ | ||
| + | |||
| + | < | ||
| + | |||
| + | or edit cron job | ||
| + | |||
| + | < | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | |||
| ===== How do I replace a disk marked as removed from a linux md raid-5 array ===== | ===== How do I replace a disk marked as removed from a linux md raid-5 array ===== | ||
| Line 8: | Line 22: | ||
| First identify removed drive: | First identify removed drive: | ||
| < | < | ||
| + | Find serial number, if necessary: | ||
| + | < | ||
| - | the, if drive is **just remved**: | + | If drive is **just remved**: |
| < | < | ||
| mdadm /dev/md0 --add / | mdadm /dev/md0 --add / | ||
| Line 15: | Line 31: | ||
| If **replacing damaged** drive, then only: | If **replacing damaged** drive, then only: | ||
| < | < | ||
| + | === Check every drive manually === | ||
| + | |||
| + | < | ||
| + | |||
| + | ====== “not enough to start the array” – error while staring mdadm RAID array ====== | ||
| + | |||
| + | Stop failed array: | ||
| + | < | ||
| + | |||
| + | | ||
| + | < | ||
| + | |||
| + | |||
| + | RUN raid 1 with one disk: | ||
| + | < | ||
| + | mdadm --run /dev/md126 | ||
| + | </ | ||
| + | |||
| + | Then Add disk: | ||
| + | < | ||
| + | mdadm --manage /dev/md126 --add /dev/sdf4 | ||
| + | </ | ||
| + | |||
| + | ====== Test Email Settings ====== | ||
| + | |||
| + | < | ||
| + | |||
| + | If got error: **" | ||
| + | < | ||
| + | |||
| + | |||
| + | |||
| + | ====== Simple Script to read Hdd serial numbers ====== | ||
| + | |||
| + | < | ||
| + | smartctl -a /dev/sda | grep -i ' | ||
| + | echo ""; | ||
| + | echo ""; | ||
| + | |||
| + | for i in {a..z} ; do | ||
| + | echo $i | ||
| + | smartctl -a /dev/sd$i | grep -i ' | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | ====== A SparesMissing event had been detected on md device ====== | ||
| + | |||
| + | Removing the spares=1 option or just recreating the mdadm.conf from scratch fixes the problem: | ||
| + | |||
| + | ====== **Update MDADM config file** ====== | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | Double check new configuration ad then save as mdadm.conf | ||
| + | |||
| + | ====== **Just in case** ====== | ||
| + | |||
| + | Run < | ||
| + | ====== Speed Up or Slow Down Raid rebuild ====== | ||
| + | |||
| + | To see current limits, enter: | ||
| + | |||
| + | < | ||
| + | sysctl dev.raid.speed_limit_max</ | ||
| + | |||
| + | |||
| + | To change minimal speed (ex. min.= 10000), enter: | ||
| + | |||
| + | < | ||
| + | |||
| + | or | ||
| + | < | ||
| + | |||
| + | To change maximal speed (ex. max.= 200000), enter: | ||
| + | |||
| + | < | ||
| + | |||
| + | or | ||
| + | < | ||
| + | |||
| + | |||
| + | If you want to override the defaults you could add these two lines to: < | ||
| + | |||
| + | < | ||
| + | ## You are limited by CPU and memory too # | ||
| + | ########################################### | ||
| + | dev.raid.speed_limit_min = 50000 | ||
| + | ## good for 4-5 disks based array ## | ||
| + | dev.raid.speed_limit_max = 2000000 | ||
| + | ## good for large 6-12 disks based array ### | ||
| + | dev.raid.speed_limit_max = 5000000</ | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | |||
| + | |||
| + | ===== Speed Change Script Example ===== | ||
| + | |||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | clear; | ||
| + | speed=$(cat / | ||
| + | echo "" | ||
| + | echo -e " | ||
| + | echo "" | ||
| + | echo -e " | ||
| + | tput setaf 2 | ||
| + | tput bold | ||
| + | if [[ $speed == ' | ||
| + | sysctl -w dev.raid.speed_limit_max=10000 | cut -c 28- | sed -e ' | ||
| + | sysctl -w dev.raid.speed_limit_min=1000 | ||
| + | else | ||
| + | sysctl -w dev.raid.speed_limit_max=150000 | cut -c 28- | sed -e ' | ||
| + | sysctl -w dev.raid.speed_limit_min=10000 | ||
| + | fi | ||
| + | tput sgr0 | ||
| + | </ | ||