Rozdíly

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

Odkaz na výstup diff

Následující verze
Předchozí verze
mdadm [2019/05/05 23:50]
0.0.0.0 vytvořeno
mdadm [2020/05/12 02:44]
simandl
Řá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=
- [[root@simlin|~]]#​ parted /dev/sde +  ​[[root@simlin|~]]#​ parted /dev/sde 
- GNU Parted 1.8.1 +  GNU Parted 1.8.1 
- Using /dev/sde +  Using /dev/sde 
- ​Welcome to GNU Parted! Type '​help'​ to view a list of commands. +  Welcome to GNU Parted! Type '​help'​ to view a list of commands. 
- ​(parted) mklabel gpt +  (parted) mklabel gpt 
- ​(parted) unit TB +  (parted) unit TB 
- ​(parted) mkpart primary 0 3 +  (parted) mkpart primary 0 3 
- ​(parted) print +  (parted) print 
-  +   
- ​Model:​ ATA WDC WD30EFRX-68A (scsi) +  Model: ATA WDC WD30EFRX-68A (scsi) 
- Disk /dev/sde: 3.00TB +  Disk /dev/sde: 3.00TB 
- ​Sector size (logical/​physical):​ 512B/512B +  Sector size (logical/​physical):​ 512B/512B 
- ​Partition Table: gpt +  Partition Table: gpt 
-  +   
- ​Number ​ Start   ​End ​    ​Size ​   File system ​ Name     ​Flags +  Number ​ Start   ​End ​    ​Size ​   File system ​ Name     ​Flags 
-  1      0.00TB ​ 3.00TB ​ 3.00TB ​              ​primary +   ​1      0.00TB ​ 3.00TB ​ 3.00TB ​              ​primary 
-  +   
- ​(parted) quit +  (parted) quit 
- ​Information:​ Don't forget to update /etc/fstab, if necessary.+  Information:​ Don't forget to update /etc/fstab, if necessary.
  
 =mkfs= =mkfs=
 http://​busybox.net/​~aldot/​mkfs_stride.html http://​busybox.net/​~aldot/​mkfs_stride.html
  
- 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