Mdadm

=mdadm příkazy= mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/sdab1

mdadm –manage /dev/md0 –fail /dev/sdb3

mdadm –manage /dev/md0 –remove /dev/sdb3

mdadm –manage /dev/md0 –add /dev/sdc3

echo 'DEVICE /dev/hd*0-9 /dev/sd*0-9' > mdadm.conf

mdadm –detail –scan » mdadm.conf

mdadm –grow –bitmap=internal /dev/md0

mdadm –grow –bitmap=none /dev/md0

mdadm –assemble /dev/md3 /dev/sdb3 /dev/sdc3

umount /dev/md0

mdadm –manage /dev/md0 –stop

mdadm –zero-superblock /dev/sdg1

mdadm –create /dev/md0 –chunk=128 –level=raid6 –raid-devices=6 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1

mdadm –run –readonly /dev/md0

mdadm –examine /dev/sda1

mdadm -S /dev/md0

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=

[[root@simlin|~]]# parted /dev/sde
GNU Parted 1.8.1
Using /dev/sde
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0 3
(parted) print

Model: ATA WDC WD30EFRX-68A (scsi)
Disk /dev/sde: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB               primary

(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.

=mkfs= http://busybox.net/~aldot/mkfs_stride.html

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

=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= ~# cat /proc/mdstat Personalities : raid1 md0 : active raid1 sdb12 sda11

     2930266412 blocks super 1.0 [[2/2]] [UU]
     bitmap: 3/22 pages [[12KB]], 65536KB chunk

unused devices: <none> ~# cat /sys/block/md0/md/sync_action idle ~# echo 'check' > /sys/block/md0/md/sync_action ~# cat /sys/block/md0/md/sync_action check ~# cat /proc/mdstat Personalities : raid1 md0 : active raid1 sdb12 sda11

     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