Umgang mit redundanten Laufwerken unter Debian 7.3 (GRUB2)
| Dieser Artikel oder Teile davon wurden mit 'Review' markiert. Das bedeutet, dass größere Arbeiten am Inhalt des Artikels abgeschlossen sind und der Autor eine Korrekturlesung durch andere User zur Qualitätssicherung für angebracht hält.
Zu sichtende Teile: Kompletter Artikel Bitte hilf LinuxClubWiki, indem du den zu sichtenden Teil überprüfst und den Artikel gegebenenfalls überarbeitest! |
--Gehrke (Diskussion) 07:22, 19. Dez. 2013 (CET)
Diese Seite gehört zum Kontext Umgang mit redundanten Laufwerken (GRUB2).
Inhaltsverzeichnis
Systembeschreibung
Als Betriebssystem wird Debian 7.3 verwendet. Bei der Installation wurde GRUB2 in den MBR geschrieben.
Partitionierung:
root@localhost:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 8G 0 disk
├─sdb1 8:17 0 190M 0 part
│ └─md0 9:0 0 189,8M 0 raid1 /boot
├─sdb2 8:18 0 1K 0 part
└─sdb5 8:21 0 7,8G 0 part
└─md1 9:1 0 7,8G 0 raid1
└─md1_crypt (dm-0) 253:0 0 7,8G 0 crypt
├─system-swap (dm-1) 253:1 0 952M 0 lvm [SWAP]
└─system-root (dm-2) 253:2 0 6,9G 0 lvm /
sda 8:0 0 8G 0 disk
├─sda1 8:1 0 190M 0 part
│ └─md0 9:0 0 189,8M 0 raid1 /boot
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 7,8G 0 part
└─md1 9:1 0 7,8G 0 raid1
└─md1_crypt (dm-0) 253:0 0 7,8G 0 crypt
├─system-swap (dm-1) 253:1 0 952M 0 lvm [SWAP]
└─system-root (dm-2) 253:2 0 6,9G 0 lvm /
Zustand des Arrays:
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sda1[0] sdb1[1]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Details zum RAID:
root@localhost:~# mdadm -Evvs
mdadm: No md superblock detected on /dev/dm-2.
mdadm: No md superblock detected on /dev/dm-1.
mdadm: No md superblock detected on /dev/dm-0.
mdadm: No md superblock detected on /dev/md/1.
mdadm: No md superblock detected on /dev/md/0.
/dev/sda5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 32944ed5:b82d51f1:1ba2099b:a050ee3a
Name : localhost:1 (local to host localhost)
Creation Time : Mon Dec 16 20:25:01 2013
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 16373760 (7.81 GiB 8.38 GB)
Array Size : 8186816 (7.81 GiB 8.38 GB)
Used Dev Size : 16373632 (7.81 GiB 8.38 GB)
Data Offset : 8192 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 64d39e12:877b01fe:19b6f8f2:46cd7dd9
Update Time : Mon Dec 16 22:34:13 2013
Checksum : 9ef27d80 - correct
Events : 19
Device Role : Active device 0
Array State : AA ('A' == active, '.' == missing)
/dev/sda2:
MBR Magic : aa55
Partition[0] : 16381952 sectors at 2 (type fd)
/dev/sda1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : ca2c7b65:65ed072d:778a5637:f2e4b457
Name : localhost:0 (local to host localhost)
Creation Time : Mon Dec 16 20:24:49 2013
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 388864 (189.91 MiB 199.10 MB)
Array Size : 194368 (189.84 MiB 199.03 MB)
Used Dev Size : 388736 (189.84 MiB 199.03 MB)
Data Offset : 256 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 62488525:4edc87af:313e7d05:a677a4a8
Update Time : Mon Dec 16 22:28:14 2013
Checksum : c8186838 - correct
Events : 17
Device Role : Active device 0
Array State : AA ('A' == active, '.' == missing)
/dev/sda:
MBR Magic : aa55
Partition[0] : 389120 sectors at 2048 (type fd)
Partition[1] : 16381954 sectors at 393214 (type 05)
/dev/sdb5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 32944ed5:b82d51f1:1ba2099b:a050ee3a
Name : localhost:1 (local to host localhost)
Creation Time : Mon Dec 16 20:25:01 2013
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 16373760 (7.81 GiB 8.38 GB)
Array Size : 8186816 (7.81 GiB 8.38 GB)
Used Dev Size : 16373632 (7.81 GiB 8.38 GB)
Data Offset : 8192 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 3f4487fb:fd3b39ea:39922bc2:f63b38ee
Update Time : Mon Dec 16 22:34:13 2013
Checksum : 57fff9a3 - correct
Events : 19
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing)
/dev/sdb2:
MBR Magic : aa55
Partition[0] : 16381952 sectors at 2 (type fd)
/dev/sdb1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : ca2c7b65:65ed072d:778a5637:f2e4b457
Name : localhost:0 (local to host localhost)
Creation Time : Mon Dec 16 20:24:49 2013
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 388864 (189.91 MiB 199.10 MB)
Array Size : 194368 (189.84 MiB 199.03 MB)
Used Dev Size : 388736 (189.84 MiB 199.03 MB)
Data Offset : 256 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 7f7c9167:42d97094:a7502c20:5db28f34
Update Time : Mon Dec 16 22:28:14 2013
Checksum : 95a7e677 - correct
Events : 17
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing)
/dev/sdb:
MBR Magic : aa55
Partition[0] : 389120 sectors at 2048 (type fd)
Partition[1] : 16381954 sectors at 393214 (type 05)
Diese grub.cfg wurde bei der Installation geschrieben:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}
set timeout=5
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, mit Linux 3.2.0-4-amd64' --class debian --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/ca2c7b6565ed072d778a5637f2e4b457)'
search --no-floppy --fs-uuid --set=root ea571b5a-84e4-45d5-8553-9c3c08a9cd31
echo 'Linux 3.2.0-4-amd64 wird geladen …'
linux /vmlinuz-3.2.0-4-amd64 root=/dev/mapper/system-root ro quiet
echo 'Initiale Ramdisk wird geladen …'
initrd /initrd.img-3.2.0-4-amd64
}
menuentry 'Debian GNU/Linux, mit Linux 3.2.0-4-amd64 (Wiederherstellungsmodus)' --class debian --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/ca2c7b6565ed072d778a5637f2e4b457)'
search --no-floppy --fs-uuid --set=root ea571b5a-84e4-45d5-8553-9c3c08a9cd31
echo 'Linux 3.2.0-4-amd64 wird geladen …'
linux /vmlinuz-3.2.0-4-amd64 root=/dev/mapper/system-root ro single
echo 'Initiale Ramdisk wird geladen …'
initrd /initrd.img-3.2.0-4-amd64
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Funktionale Tests
Test 1: Boot-Partitionen im RAID abschalten
Mit diesem Test wird der Ausfall jeweils einer Partition simuliert. Das System sollte dank der Redundanz fehlerfrei booten.
Eine Boot-Partition aus dem RAID entfernen:
root@localhost:~# mdadm --set-faulty /dev/md0 /dev/sda1
mdadm: set /dev/sda1 faulty in /dev/md0
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sda1[0](F) sdb1[1]
194368 blocks super 1.2 [2/1] [_U]
unused devices: <none>
root@localhost:~# reboot
Reboot funktionierte problemlos von beiden Platten (F12).
Partition hinzufügen (etwas warten bis Recovery-Prozess abgeschlossen ist) und andere entfernen:
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[1]
194368 blocks super 1.2 [2/1] [_U]
unused devices: <none>
root@localhost:~# mdadm --add /dev/md0 /dev/sda1
mdadm: added /dev/sda1
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sda1[2] sdb1[1]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
root@localhost:~# mdadm --set-faulty /dev/md0 /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sda1[2] sdb1[1](F)
194368 blocks super 1.2 [2/1] [U_]
unused devices: <none>
root@localhost:~# reboot
Reboot funktionierte problemlos von beiden Platten (F12).
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sda1[2]
194368 blocks super 1.2 [2/1] [U_]
unused devices: <none>
root@localhost:~# mdadm --add /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0] sdb5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[3] sda1[2]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Fazit: OK
Test 2: Festplatten entfernen
Zur Simulation einer ausgefallenen Festplatte wurde vor dem Start die Festplatte aus der Konfiguration von VirtualBox entfernt.
Fall 1: Nur Festplatte 1 im System
Beobachtung: Bootet problemlos
user@localhost:~$ cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda5[0]
8186816 blocks super 1.2 [2/1] [U_]
md0 : active raid1 sda1[0]
194368 blocks super 1.2 [2/1] [U_]
unused devices: <none>
Fazit: OK
Fall 2: Nur Festplatte 2 im System
Beobachtung: Das Menü von GRUB erscheint nicht.
Vermutung: GRUB-Installation fehlt im MBR auf zweiter Festplatte.
Lösungsversuch 1: Installation nachgeholt:
root@localhost:~# grub-install /dev/sdb
Installation finished. No error reported.
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb5[0] sda5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[0] sda1[1]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Boot funktionierte nicht, weil VirtualBox die Festplatten-Reihenfolge vertauscht hatte. System ließ sich mit expliziter Auswahl der zweiten Festplatte (F12) booten.
Lösungsversuch 2: Installation nachgeholt:
root@localhost:~# grub-install /dev/sda
Installation finished. No error reported.
root@localhost:~# grub-install /dev/sdb
Installation finished. No error reported.
root@localhost:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb5[0] sda5[1]
8186816 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[0] sda1[1]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Diesmal bootete das System in allen Varianten!
Fazit: OK