IT-Dienstleistungen & smartes Equipment
  • IT-Infrastruktur

    Server, Netzwerktechnik, Beratung
  • Smart|Stuff

    clevere Items Haus, Tier & Alltag
By - admin

RAID Recovery auf Ubuntu

Hier eine sehr kleine Anleitung zum Wiederaufbau eines RAID unter Linux. In diesem Fall ein RAID1 mit zwei Festplatten auf einem Rack-PC. In diesem System ist mit “upper slot” das Device sda gemeint. Geben Sie die Befehle nicht blind ein. Ein vertauschter Buchstabe und es gibt möglicherweise gar kein RAID mehr 😉

—————-

On both drives: Primary partition („/”, 157 GB), Extended (Swap, 3 GB)

/dev/md0 : Root filesystem

/dev/md1 : Swap

—————–

Assuming /dev/sda failed and RAID is degraded (check „/proc/mdstat” and „mdadm -D /dev/md0″), boot the system with a clean drive inserted to the upper slot. (Might need to answer yes first when beeing asked whether to boot from the degraded RAID).

  • Make sure that you did not mix up sda and sdb via „sfdisk -d /dev/sda”. This should give an empty partition table for the new drive. Perhaps you like to see the intact partition table of drive b by typing „sfdisk -d /dev/sdb”.
  • Copy the partition table to the blank drive: „sfdisk -d /dev/sdb | sfdisk /dev/sda”.
  • Add /dev/sda1 to /dev/md0: „mdadm /dev/md0 -a /dev/sda1″
  • Add /dev/sda5 to /dev/md1 „mdadm /dev/md1 -a /dev/sda5″
    (Perhaps you will have to set /dev/md1 active first as it is not run by default when booting: „mdadm -R /dev/md1″)
  • Make md1 a swap device: „mkswap /dev/md1″ (Probably not necessary)
  • Start up the swap device: „swapon -a”
  • Watch the rebuilding process: „watch cat /proc/mdstat”
  • Install Grub:
    • “grub”
    • “find /boot/grub/menu.lst” to show occurences of the grub-menu-config on both drives
    • “root (hd0,1)”
    • “setup (hd0)”

If /dev/sdb failed:

  • Copy the partition table to the blank drive: „sfdisk -d /dev/sda | sfdisk /dev/sdb”.
  • Add /dev/sdb1 to /dev/md0: „mdadm /dev/md0 -a /dev/sdb1″
  • Add /dev/sdb5 to /dev/md1 „mdadm /dev/md1 -a /dev/sdb5″
    (Perhaps you will have to set /dev/md1 active first as it is not run by default when booting: „mdadm -R /dev/md1″)
  • Make md1 a swap device: „mkswap /dev/md1″ (Probably not necessary)
  • Start up the swap device: „swapon -a”
  • Watch the rebuilding process: „watch cat /proc/mdstat”
  • Install Grub:
    • “grub”
    • “find /boot/grub/menu.lst” to show occurences of the grub-menu-config on both drives
    • “root (hd1,1)”
    • “setup (hd1)”