Technologieführer

Software-RAID1 auf laufendem Mandriva 2008.0 vorbereiten

3 min read Systemadministration Aktualisiert 17 Oct 2025
RAID1 auf Mandriva: /dev/hda vorbereiten
RAID1 auf Mandriva: /dev/hda vorbereiten

Voraussetzungen

  • Ein laufendes RAID1 auf /dev/hdb (zweite Festplatte).
  • Neue oder geleerte Festplatte als /dev/hda mit passenden Partitionen (1, 5, 6).
  • Root-Rechte auf dem System.

7 Vorbereitung von /dev/hda

Wenn alles korrekt ist, sollten /dev/md0 und /dev/md2 in der Ausgabe von

df -h

erscheinen. Beispielausgabe:

[root@server1 ~]# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/md2              4.4G  757M  3.4G  18% /  
/dev/md0              167M  9.0M  150M   6% /boot  
[root@server1 ~]#

Die Ausgabe von

cat /proc/mdstat

sollte in etwa so aussehen:

[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hdb5[1]  
      417536 blocks [2/1] [_U]  
  
md0 : active raid1 hdb1[1]  
      176576 blocks [2/1] [_U]  
  
md2 : active raid1 hdb6[1]  
      4642688 blocks [2/1] [_U]  
  
unused devices:   
[root@server1 ~]#

Nun müssen wir den Partitionstyp für die drei Partitionen auf /dev/hda auf “Linux raid autodetect” ändern. Starten Sie fdisk:

fdisk /dev/hda

Beispielinteraktion (Ausgabe unverändert):

[root@server1 ~]# fdisk /dev/hda  
  
Command (m for help): <-- t  
Partition number (1-6): <-- 1  
Hex code (type L to list codes): <-- fd  
Changed system type of partition 1 to fd (Linux raid autodetect)  
  
Command (m for help): <-- t  
Partition number (1-6): <-- 5  
Hex code (type L to list codes): <-- fd  
Changed system type of partition 5 to fd (Linux raid autodetect)  
  
Command (m for help): <-- t  
Partition number (1-6): <-- 6  
Hex code (type L to list codes): <-- fd  
Changed system type of partition 6 to fd (Linux raid autodetect)  
  
Command (m for help): <-- w  
The partition table has been altered!  
  
Calling ioctl() to re-read partition table.  
Syncing disks.  
[root@server1 ~]#

Jetzt fügen Sie /dev/hda1, /dev/hda5 und /dev/hda6 den jeweiligen RAID-Arrays hinzu:

mdadm --add /dev/md0 /dev/hda1  
mdadm --add /dev/md1 /dev/hda5  
mdadm --add /dev/md2 /dev/hda6

Schauen Sie erneut in /proc/mdstat:

cat /proc/mdstat

Sie sollten sehen, dass die Arrays synchronisiert werden:

[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hda5[2] hdb5[1]  
      417536 blocks [2/1] [_U]  
        resync=DELAYED  
  
md0 : active raid1 hda1[0] hdb1[1]  
      176576 blocks [2/2] [UU]  
  
md2 : active raid1 hda6[2] hdb6[1]  
      4642688 blocks [2/1] [_U]  
      [======>..............]  recovery = 34.4% (1597504/4642688) finish=1.0min speed=50349K/sec  
  
unused devices:   
[root@server1 ~]#

Tipp: Mit

watch cat /proc/mdstat

bekommen Sie eine fortlaufende Anzeige. Zum Beenden drücken Sie STRG+C.

Warten Sie, bis die Synchronisation abgeschlossen ist. Dann sollte die Anzeige so aussehen:

[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hda5[0] hdb5[1]  
      417536 blocks [2/2] [UU]  
  
md0 : active raid1 hda1[0] hdb1[1]  
      176576 blocks [2/2] [UU]  
  
md2 : active raid1 hda6[0] hdb6[1]  
      4642688 blocks [2/2] [UU]  
  
unused devices:   
[root@server1 ~]#

Jetzt passen Sie /etc/mdadm.conf an die neue Situation an:

cp -f /etc/mdadm.conf_orig /etc/mdadm.conf  
mdadm --examine --scan >> /etc/mdadm.conf

/etc/mdadm.conf könnte dann in etwa so aussehen (Beispiel):

cat /etc/mdadm.conf

| # mdadm configuration file # # mdadm will function properly without the use of a configuration file, # but this file is useful for keeping track of arrays and member disks. # In general, a mdadm.conf file is created, and updated, after arrays # are created. This is the opposite behavior of /etc/raidtab which is # created prior to array construction. # # # the config file takes two types of lines: # # DEVICE lines specify a list of devices of where to look for # potential member disks # # ARRAY lines specify information about how to identify arrays so # so that they can be activated # # You can have more than one device line and use wild cards. The first # example includes SCSI the first partition of SCSI disks /dev/sdb, # /dev/sdc, /dev/sdd, /dev/sdj, /dev/sdk, and /dev/sdl. The second # line looks for array slices on IDE disks. # #DEVICE /dev/sd[bcdjkl]1 #DEVICE /dev/hda1 /dev/hdb1 # # If you mount devfs on /dev, then a suitable way to list all devices is: #DEVICE /dev/discs/*/* # # # # ARRAY lines specify an array to assemble and a method of identification. # Arrays can currently be identified by using a UUID, superblock minor number, # or a listing of devices. # # super-minor is usually the minor number of the metadevice # UUID is the Universally Unique Identifier for the array # Each can be obtained using # # mdadm -D # #ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371 #ARRAY /dev/md1 super-minor=1 #ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1 # # ARRAY lines can also specify a "spare-group" for each array. mdadm --monitor # will then move a spare between arrays in a spare-group if one array has a failed # drive but no spare #ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df spare-group=group1 #ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 spare-group=group1 # # When used in --follow (aka --monitor) mode, mdadm needs a # mail address and/or a program. This can be given with "mailaddr" # and "program" lines to that monitoring can be started using # mdadm --follow --scan & echo $! > /var/run/mdadm # If the lines are not found, mdadm will exit quietly #MAILADDR [email protected] #PROGRAM /usr/sbin/handle-mdadm-events ARRAY /dev/md0 level=raid1 num-devices=2 UUID=6b4f013f:6fe18719:5904a9bd:70e9cee6 ARRAY /dev/md1 level=raid1 num-devices=2 UUID=63194e2e:c656857a:3237a906:0616f49e ARRAY /dev/md2 level=raid1 num-devices=2 UUID=edec7105:62700dc0:643e9917:176563a7 |

8 GRUB vorbereiten (Teil 2)

Fast geschafft. Als nächstes ändern Sie /boot/grub/menu.lst: derzeit bootet GRUB von /dev/hdb (hd1,0). Damit das System auch dann bootet, wenn /dev/hdb ausfällt, kopieren Sie die erste Kernel-Strophe, fügen sie darunter ein und ersetzen hd1 durch hd0. Kommentieren Sie alle anderen Strophen aus. Beispiel:

vi /boot/grub/menu.lst

| timeout 10 color black/cyan yellow/cyan default 0 fallback 1 title linux kernel (hd1,0)/vmlinuz BOOT_IMAGE=linux root=/dev/md2 resume=/dev/md1 initrd (hd1,0)/initrd.img title linux kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/md2 resume=/dev/md1 initrd (hd0,0)/initrd.img #title linux #kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/hda6 resume=/dev/hda5 #initrd (hd0,0)/initrd.img #title failsafe #kernel (hd0,0)/vmlinuz BOOT_IMAGE=failsafe root=/dev/hda6 failsafe #initrd (hd0,0)/initrd.img |

Anschließend aktualisieren Sie Ihre Ramdisk:

mv /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img_orig2  
mkinitrd /boot/initrd-`uname -r`.img `uname -r`

Starten Sie dann neu:

reboot

Das System sollte nun ohne Probleme booten.

Wann das fehlschlägt (Kurzüberblick)

  • Partitionstabelle wird nicht neu eingelesen: manchmal muss ein Reboot erfolgen oder partprobe ausgeführt werden.
  • Falsche Partitionstypen: mdadm ignoriert Partitionen, wenn der Typ nicht auf fd gesetzt ist.
  • Bootloader nicht auf Zweitlaufwerk installiert: wenn /dev/hda keinen GRUB-MBR hat, kann ein Ausfall von /dev/hdb zum Nicht-Booten führen.

Alternative Ansätze

  • Verwenden Sie eine UUID-basierte ROOT-Angabe im GRUB, um Geräte-Name-Änderungen robuster zu behandeln.
  • Statt manueller mdadm-Konfiguration ein Automatisierungs-Tool (Ansible/Chef) nutzen, wenn viele Systeme betroffen sind.
  • Für kritische Systeme Hardware-RAID einsetzen, um Boot-abhängigkeiten zu reduzieren.

Rolle-basierte Checkliste

  • Systemadministrator: Partitionstypen setzen, mdadm –add ausführen, mdstat überwachen.
  • Boot-Administrator: GRUB-Einträge anpassen, GRUB auf beide Platten schreiben (grub-install).
  • Operator/Tester: Nach Neustart prüfen, ob /proc/mdstat alle Arrays als [UU] zeigt und Dienste laufen.

Mini-Methodik (schnell)

  1. Partitionstypen ändern (fdisk).
  2. mdadm –add für jeweilige Partitionen.
  3. Synchronisation per /proc/mdstat beobachten.
  4. mdadm.conf aktualisieren.
  5. GRUB-Strophen duplizieren und anpassen.
  6. Initramfs aktualisieren, Neustart, Verifikation.

Ein-Zeilen-Glossar

  • mdadm: Linux-Tool zum Erstellen und Verwalten von Software-RAID.
  • mdX: Gerätebezeichnung für ein RAID-Array (z. B. /dev/md0).
  • fd: Partitionstyp-Code für “Linux raid autodetect”.

Kriterien zur Abnahme

  • Alle RAID-Arrays sind synchronisiert und in /proc/mdstat als [UU] gelistet.
  • /etc/mdadm.conf enthält die ARRAY-Zeilen für md0, md1, md2.
  • GRUB hat eine Boot-Strophe für hd0 und hd1, und das System bootet nach Neustart von beiden Platten (getestet durch temporäres Entfernen einer Platte oder Boot-Order-Simulation).

Kurze Zusammenfassung

Sie haben jetzt /dev/hda so vorbereitet, dass sie den laufenden RAID1 ergänzt: Partitionstypen gesetzt, Partitionen in die Arrays eingefügt, Synchronisation abgewartet, mdadm.conf aktualisiert, GRUB angepasst und die Initramfs neu erstellt. Nach Neustart sollte das System redundant von beiden Platten booten.

Wichtig: Prüfen Sie immer /proc/mdstat, /etc/mdadm.conf und testen Sie einen Boot-Failover, bevor Sie das System als produktiv betrachten.

Autor
Redaktion

Ähnliche Materialien

KI-Apps zum Englischlernen – Top 10 & Auswahlhilfe
Sprachen

KI-Apps zum Englischlernen – Top 10 & Auswahlhilfe

Untertitel in Final Cut Pro hinzufügen
Video-Editing

Untertitel in Final Cut Pro hinzufügen

BIKA LIMS auf Ubuntu Server in 15 Minuten installieren
LIMS Anleitung

BIKA LIMS auf Ubuntu Server in 15 Minuten installieren

iPhone-Akku optimieren: Laufzeit & Gesundheit
Akku

iPhone-Akku optimieren: Laufzeit & Gesundheit

Fehler 0x800F0909 bei Sprachpaket-Installation beheben
Windows

Fehler 0x800F0909 bei Sprachpaket-Installation beheben

launcher-list-indicator: Unity Launcher mit Profilen
Ubuntu

launcher-list-indicator: Unity Launcher mit Profilen