Technologieführer

Software-RAID1 auf laufendem LVM einrichten

3 min read Systemadministration Aktualisiert 27 Sep 2025
Software-RAID1 auf laufendem LVM einrichten
Software-RAID1 auf laufendem LVM einrichten

Kurzfassung: Installieren Sie GRUB auf der zweiten Festplatte, prüfen Sie das RAID- und LVM-Setup, ändern Sie bei Bedarf den Partitions-Typ von /dev/sda1 auf “Linux raid autodetect” und fügen Sie die Partition wieder dem md0-Array hinzu. Neustart und Kontrolle von /proc/mdstat und LVM-Tools bestätigen den Erfolg.

Vorbereitung von GRUB

Anschließend müssen wir den GRUB-Bootloader auf der zweiten Festplatte /dev/sdb installieren:

grub

Geben Sie in der GRUB-Shell die folgenden Befehle ein:

root (hd0,0)
grub> root (hd0,0)  
 Filesystem type is ext2fs, partition type 0x83  
  
grub>
setup (hd0)
grub> setup (hd0)  
 Checking if "/boot/grub/stage1" exists... no  
 Checking if "/grub/stage1" exists... yes  
 Checking if "/grub/stage2" exists... yes  
 Checking if "/grub/e2fs_stage1_5" exists... yes  
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.  
succeeded  
 Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded  
Done.  
  
grub>
root (hd1,0)
grub> root (hd1,0)  
 Filesystem type is ext2fs, partition type 0xfd  
  
grub>
setup (hd1)
grub> setup (hd1)  
 Checking if "/boot/grub/stage1" exists... no  
 Checking if "/grub/stage1" exists... yes  
 Checking if "/grub/stage2" exists... yes  
 Checking if "/grub/e2fs_stage1_5" exists... yes  
 Running "embed /grub/e2fs_stage1_5 (hd1)"...  16 sectors are embedded.  
succeeded  
 Running "install /grub/stage1 (hd1) (hd1)1+16 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded  
Done.  
  
grub>
quit

Zurück in der normalen Shell starten Sie das System neu und prüfen, ob vom RAID-Array gebootet wird:

reboot

Wichtig

  • Achten Sie auf die Zuordnung von hd0/hd1 zu /dev/sda und /dev/sdb in der GRUB-Shell; sie kann je nach BIOS/UEFI-Reihenfolge variieren. Vergewissern Sie sich, dass Sie auf dem richtigen Gerät arbeiten.
  • Führen Sie diese Schritte nur mit einem konsistenten Backup oder in einer Testumgebung durch, wenn möglich.

Vorbereitung von /dev/sda

Wenn alles geklappt hat, sollten Sie jetzt /dev/md0 in der Ausgabe von df -h sehen:

df -h
[root@server1 ~]# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/mapper/VolGroup00-LogVol00  
                      4.1G  2.0G  1.9G  51% /  
/dev/md0              190M   16M  165M   9% /boot  
tmpfs                 151M     0  151M   0% /dev/shm  
[root@server1 ~]#

Die Ausgabe von

cat /proc/mdstat

sollte wie folgt aussehen:

[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1] [raid6] [raid5] [raid4]  
md0 : active raid1 sdb1[1]  
      200704 blocks [2/1] [_U]  
  
md1 : active raid1 sda2[0] sdb2[1]  
      5036288 blocks [2/2] [UU]  
  
unused devices:   
[root@server1 ~]#

Die Ausgaben von pvdisplay, vgdisplay und lvdisplay sollten ebenfalls den erwarteten Zustand des LVM widerspiegeln:

pvdisplay
[root@server1 ~]# pvdisplay  
  --- Physical volume ---  
  PV Name               /dev/md1  
  VG Name               VolGroup00  
  PV Size               4.80 GB / not usable 22.25 MB  
  Allocatable           yes  
  PE Size (KByte)       32768  
  Total PE              153  
  Free PE               1  
  Allocated PE          152  
  PV UUID               pS3xiy-AEnZ-p3Wf-qY2D-cGus-eyGl-03mWyg  
  
[root@server1 ~]#
vgdisplay
[root@server1 ~]# vgdisplay  
  --- Volume group ---  
  VG Name               VolGroup00  
  System ID  
  Format                lvm2  
  Metadata Areas        1  
  Metadata Sequence No  9  
  VG Access             read/write  
  VG Status             resizable  
  MAX LV                0  
  Cur LV                2  
  Open LV               2  
  Max PV                0  
  Cur PV                1  
  Act PV                1  
  VG Size               4.78 GB  
  PE Size               32.00 MB  
  Total PE              153  
  Alloc PE / Size       152 / 4.75 GB  
  Free  PE / Size       1 / 32.00 MB  
  VG UUID               jJj1DQ-SvKY-6hdr-3MMS-8NOd-pb3l-lS7TA1  
  
[root@server1 ~]#
lvdisplay
[root@server1 ~]# lvdisplay  
  --- Logical volume ---  
  LV Name                /dev/VolGroup00/LogVol00  
  VG Name                VolGroup00  
  LV UUID                yt5b4f-m2XC-F3aP-032r-ulAT-Re5P-lmh6hy  
  LV Write Access        read/write  
  LV Status              available  
  # open                 1  
  LV Size                4.16 GB  
  Current LE             133  
  Segments               1  
  Allocation             inherit  
  Read ahead sectors     0  
  Block device           253:0  
  
  --- Logical volume ---  
  LV Name                /dev/VolGroup00/LogVol01  
  VG Name                VolGroup00  
  LV UUID                VrPqpP-40ym-55Gs-ShVm-Hlzs-Jzot-oYnonY  
  LV Write Access        read/write  
  LV Status              available  
  # open                 1  
  LV Size                608.00 MB  
  Current LE             19  
  Segments               1  
  Allocation             inherit  
  Read ahead sectors     0  
  Block device           253:1  
  
[root@server1 ~]#

Nun müssen wir den Partitions-Typ von /dev/sda1 ebenfalls auf Linux raid autodetect ändern:

fdisk /dev/sda
[root@server1 ~]# fdisk /dev/sda  
  
Command (m for help): <- t  
Partition number (1-4): <- 1  
Hex code (type L to list codes): <- fd  
Changed system type of partition 1 to fd (Linux raid autodetect)  
  
Command (m for help): <- w  
The partition table has been altered!  
  
Calling ioctl() to re-read partition table.  
  
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.  
The kernel still uses the old table.  
The new table will be used at the next reboot.  
Syncing disks.  
[root@server1 ~]#

Nun können wir /dev/sda1 zum RAID-Array /dev/md0 hinzufügen:

mdadm --add /dev/md0 /dev/sda1

Anschließend prüfen Sie erneut den Status:

cat /proc/mdstat
[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1] [raid6] [raid5] [raid4]  
md0 : active raid1 sda1[0] sdb1[1]  
      200704 blocks [2/2] [UU]  
  
md1 : active raid1 sda2[0] sdb2[1]  
      5036288 blocks [2/2] [UU]  
  
unused devices:   
[root@server1 ~]#

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

mdadm --examine --scan > /etc/mdadm.conf

Die Datei /etc/mdadm.conf sollte nun ähnlich aussehen:

cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=7d2bf9c3:7cd9df21:f782dab8:9212d7cb
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=d93a2387:6355b5c5:25ed3e50:2a0e4f96

Starten Sie das System neu:

reboot

Es sollte ohne Probleme booten.

Troubleshooting und typische Fehler

  • RAID rebuild bleibt im Zustand “resync” zu lange: Prüfen Sie mit dmesg und smartctl, ob ein Laufwerk Fehler aufweist. Manchmal ist I/O-Limitierung oder ein fehlerhaftes Kabel die Ursache.
  • Partitionstabelle konnte nicht neu eingelesen werden: Der Kernel blockiert die Änderung, weil Partitionen noch gemountet oder in Gebrauch sind. Neustarten oder entfernen der In-Use-Handles kann helfen.
  • GRUB bootet nicht: Prüfen Sie die BIOS/UEFI-Reihenfolge und installieren Sie GRUB auf allen Boot-fähigen Datenträgern.

Checkliste für Administratoren

  • Backup wichtiger Daten vor Änderungen erstellen.
  • GRUB auf allen Bootlaufwerken installieren (hd0/hd1 entsprechend prüfen).
  • /proc/mdstat kontrollieren: Arrays müssen [UU] anzeigen.
  • pvdisplay, vgdisplay, lvdisplay prüfen: LVM muss vollständig verfügbar sein.
  • /etc/mdadm.conf aktualisieren und speichern.
  • System neu starten und Bootvorgang prüfen.

Mini-Methodik

  1. GRUB-Shell öffnen und GRUB auf Zielgerät installieren.
  2. RAID-Status prüfen (/proc/mdstat).
  3. Partitions-Typ anpassen (fdisk) und Partition zum md-Array hinzufügen.
  4. mdadm-Konfiguration aktualisieren und Neustart.

Kurzglossar

  • RAID1: Spiegelung zweier Laufwerke für Redundanz.
  • mdadm: Linux-Tool zur Verwaltung von Software-RAIDs.
  • LVM: Logical Volume Manager zur flexiblen Plattenverwaltung.
  • GRUB: Bootloader zur Systemstartsteuerung.

Zusammenfassung

Sie haben nun gelernt, wie GRUB installiert, /dev/sda für RAID vorbereitet, eine Partition zu /dev/md0 hinzugefügt und die mdadm-Konfiguration aktualisiert wird. Ein anschließender Neustart überprüft, ob das System korrekt vom RAID-Array bootet.

Autor
Redaktion

Ähnliche Materialien

Python-Fehler oxzep7 schnell beheben
Fehlerbehebung

Python-Fehler oxzep7 schnell beheben

Papierkorb auf Mac wiederherstellen
macOS

Papierkorb auf Mac wiederherstellen

Gefälschte Telefonnummern in KI‑Suchergebnissen vermeiden
Online-Sicherheit

Gefälschte Telefonnummern in KI‑Suchergebnissen vermeiden

iMessage auf Android nutzen – AirMessage Guide
Anleitungen

iMessage auf Android nutzen – AirMessage Guide

Windows Server 2019: Abgesicherten Modus starten
Systemadministration

Windows Server 2019: Abgesicherten Modus starten

Snapchat-Shortcuts: erstellen, bearbeiten, löschen
Social Media

Snapchat-Shortcuts: erstellen, bearbeiten, löschen