User Tools

Site Tools


wiki:os:debian:raid

Table of Contents

RAID

debian:~# cat /proc/mdstat
Personalities : [raid1] 
md2 : active raid1 sdb2[0] sda2[1]
      975763866 blocks super 1.2 [2/2] [UU]
      bitmap: 5/466 pages [20KB], 1024KB chunk

md0 : active raid1 sdb1[0] sda1[1]
      995904 blocks [2/2] [UU]
      
unused devices: <none>

Problém s jedním zařízením (hdd1):

debian:~# cat /proc/mdstat
Personalities : [raid1] 
md0 : active raid1 hda1[0] hdd1[3](F) hdb1[1]
      1172608 blocks [3/2] [UU_]
      
unused devices: <none>

Rekonstrukce pole po výměně disku:

debian:~# cat /proc/mdstat
Personalities : [raid1] 
md0 : active raid1 hdd1[3] hda1[0] hdb1[1]
      1172608 blocks [3/2] [UU_]
      [=====>...............]  recovery = 28.0% (328768/1172608) finish=0.7min speed=18264K/sec
      
unused devices: <none>

Výměna disku

Výměna disku sdb

Výchozí stav:

root@pbx:~# cat /proc/mdstat
Personalities : [raid1] 
md2 : active (auto-read-only) raid1 sda6[0] sdb6[2]
      1174516 blocks super 1.2 [2/2] [UU]
      
md1 : active raid1 sda5[0] sdb5[2]
      877927288 blocks super 1.2 [2/2] [UU]
      
md0 : active raid1 sda1[0] sdb1[2]
      97653688 blocks super 1.2 [2/2] [UU]

Oznaceni vadneho disku (partition):

root@pbx:~# mdadm --manage /dev/md0 --fail /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
root@pbx:~#
root@pbx:~# mdadm --manage /dev/md1 --fail /dev/sdb5
mdadm: set /dev/sdb5 faulty in /dev/md1
root@pbx:~#
root@pbx:~# mdadm --manage /dev/md2 --fail /dev/sdb6
mdadm: set /dev/sdb6 faulty in /dev/md2


root@pbx:~# cat /proc/mdstat
Personalities : [raid1] 
md2 : active raid1 sda6[0] sdb6[2](F)
      1174516 blocks super 1.2 [2/1] [U_]
      
md1 : active raid1 sda5[0] sdb5[2](F)
      877927288 blocks super 1.2 [2/1] [U_]
      
md0 : active raid1 sda1[0] sdb1[2](F)
      97653688 blocks super 1.2 [2/1] [U_]
      
unused devices: <none>

Odebrani vadneho disku z raidu:

root@pbx:~# mdadm --manage /dev/md0 --remove /dev/sdb1
mdadm: hot removed /dev/sdb1 from /dev/md0
root@pbx:~#
root@pbx:~# mdadm --manage /dev/md1 --remove /dev/sdb5
mdadm: hot removed /dev/sdb5 from /dev/md1
root@pbx:~#
root@pbx:~# mdadm --manage /dev/md2 --remove /dev/sdb6
mdadm: hot removed /dev/sdb6 from /dev/md2

Výměna disku:

  • Vypnout server
  • Vyměnit disk
  • Zapnout server

Zkopirovani partition table (z sda) na nový disk (sdb):

root@pbx:~# sfdisk -d /dev/sda | sfdisk /dev/sdb
root@pbx:~# fdisk -l

Přidání partition do raidu:

mdadm --manage /dev/md0 --add /dev/sdb1
mdadm --manage /dev/md1 --add /dev/sdb5
mdadm --manage /dev/md2 --add /dev/sdb6

Kontrola:

cat /proc/mdstat

Zrušení RAIDu

mdadm --stop /dev/md125
mdadm --remove /dev/md125
wiki/os/debian/raid.txt · Last modified: 2018/07/26 11:20 by root