Rozdíly

Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.

Odkaz na výstup diff

mdadm [2019/05/05 23:50]
0.0.0.0 vytvořeno
mdadm [2019/06/02 23:39] (aktuální)
0.0.0.0 vytvořeno
Řádek 35: Řádek 35:
  
 mdadm --assemble /dev/md0 --force --uuid=a4bd7fc2:​b4d40d24:​e3edfc41:​b9f1a521 mdadm --assemble /dev/md0 --force --uuid=a4bd7fc2:​b4d40d24:​e3edfc41:​b9f1a521
 +
 +You can cancel an array resync in progress using the following sequence of commands (as root):
 +
 + echo frozen > /​sys/​block/​md0/​md/​sync_action
 + echo none > /​sys/​block/​md0/​md/​resync_start
 + echo idle > /​sys/​block/​md0/​md/​sync_action
  
 =3T disk= =3T disk=
Řádek 62: Řádek 68:
  mdadm --create /dev/md1 --level=1 --chunk=1024 --raid-devices=2 /​dev/​sd[[de]]1  mdadm --create /dev/md1 --level=1 --chunk=1024 --raid-devices=2 /​dev/​sd[[de]]1
  ​mkfs.ext3 -b 4096 -E stride=256,​stripe-width=256 /dev/md1  ​mkfs.ext3 -b 4096 -E stride=256,​stripe-width=256 /dev/md1
 +
 +=Repair bad blocks=
 +
 +https://​unix.stackexchange.com/​questions/​42277/​linux-repairing-bad-blocks-on-a-raid1-array-with-gpt
 +
 +You just need to have mdraid scrub the mirror. It'll notice the bad sector, and rewrite it automatically.
 +
 + echo '​check'​ > /​sys/​block/​mdX/​md/​sync_action ​   # use '​repair'​ instead for older kernels
 +
 + #​!/​bin/​bash
 + 
 + ​save="​$(tput sc)";
 + ​clear="​$(tput rc)$(tput el)";
 + for sync in /​sys/​block/​md*/​md/​sync_action;​ do
 +    md="​$(echo "​$sync"​ | cut -d/ -f4)"
 +    cmpl="/​sys/​block/​$md/​md/​sync_completed"​
 + 
 +    # check current state and get it repairing.
 +    read current < "​$sync"​
 +    case "​$current"​ in
 +        idle)
 +            echo '​repair'​ > "​$sync"​
 +            true
 +            ;;
 +        repair)
 +            echo "​WARNING:​ $md already repairing"​
 +            ;;
 +        check)
 +            echo "​WARNING:​ $md checking, aborting check and starting repair"​
 +            echo '​idle'​ > "​$sync"​
 +            echo '​repair'​ > "​$sync"​
 +            ;;
 +        *)
 +            echo "​ERROR:​ $md in unknown state $current. ABORT."​
 +            exit 1
 +            ;;
 +    esac
 + 
 +    echo -n "​Repair $md...$save"​ >&2
 +    read current < "​$sync"​
 +    while [[|"​$current"​ != "​idle"​ ]]; do
 +        read stat < "​$cmpl"​
 +        echo -n "​$clear $stat" >&2
 +        sleep 1
 +        read current < "​$sync"​
 +    done
 +    echo "​$clear done." >&2;
 + done
 + 
 + for dev in /dev/sd?; do
 +    echo "​Starting offline data collection for $dev."
 +    smartctl -t offline "​$dev"​
 + done
 +
 +=Example=
 + ​[[root@simlin|~]]#​ cat /​proc/​mdstat ​
 + ​Personalities : [[raid1]] ​
 + md0 : active raid1 sdb1[[2]] sda1[[1]]
 +       ​2930266412 blocks super 1.0 [[2/2]] [UU]
 +       ​bitmap:​ 3/22 pages [[12KB]], 65536KB chunk
 + 
 + ​unused devices: <​none>​
 + ​[[root@simlin|~]]#​ cat /​sys/​block/​md0/​md/​sync_action
 + idle
 + ​[[root@simlin|~]]#​ echo '​check'​ > /​sys/​block/​md0/​md/​sync_action
 + ​[[root@simlin|~]]#​ cat /​sys/​block/​md0/​md/​sync_action
 + check
 + ​[[root@simlin|~]]#​ cat /​proc/​mdstat ​
 + ​Personalities : [[raid1]] ​
 + md0 : active raid1 sdb1[[2]] sda1[[1]]
 +       ​2930266412 blocks super 1.0 [[2/2]] [UU]
 +       ​[[>​....................]] ​ check =  0.0% (12672/​2930266412) finish=42340.2min speed=1152K/​sec
 +       ​bitmap:​ 3/22 pages [[12KB]], 65536KB chunk
 + 
 + ​unused devices: <​none>​
Tisk/export