|
Suche |
Um den Software RAID zu verwalten verwenden wir das Programm mdadm.
Achtung: Es ist gefährlich mit mdadm zu hantieren wenn man dessen Funktionsweise nicht gut kennt. Sie riskieren den Verlust Ihrer Daten. Machen Sie ein Backup bevor Sie anfangen diese Hilfe zu lesen. Anmerkung: Wenn in Ihrem Server eine Festplatte ausgetauscht wurde, dann erhalten Sie diesen mit einer Festplatte im Software RAID und einer leeren Festplatte ohne Partitionstabelle zurück. Es muss also zuerst die Partition der intakten Platte auf die neue Festplatte kopiert werden. Bei einem Austausch von SDA: sfdisk -d /dev/sdb | sfdisk /dev/sda Bei einem Austausch von SDB: sfdisk -d /dev/sda | sfdisk /dev/sdb Wie kann man sehen welche Festplatte keine Partition hat? fdisk -l 1.) Installation von MDADM Das Programmpaket MDADM ist nicht standardmässig auf dem Server installiert. Bei der Release 1: rpm -Uvh --nodeps ftp://ftp.ovh.net/made-in-ovh/sources/mdadm-2.5.5p1-1.i386.rpm Retrieving ftp://ftp.ovh.net/made-in-ovh/sources/mdadm-2.5.5p1-1.i386.rpm Preparing... ########################################### [100%] 1:mdadm ########################################### [100%] 2.) Hilfe Um die Hilfe aufzurufen verwenden Sie --help # mdadm --misc --help Usage: mdadm misc_option devices... This usage is for performing some task on one or more devices, which may be arrays or components, depending on the task. The --misc option is not needed (though it is allowed) and is assumed if the first argument in a misc option. Options that are valid with the miscellaneous mode are: --query -Q : Display general information about how a device relates to the md driver --detail -D : Display details of an array --examine -E : Examine superblock on an array component --examine-bitmap -X: Display contents of a bitmap file --zero-superblock : erase the MD superblock from a device. --run -R : start a partially built array --stop -S : deactivate array, releasing all resources --readonly -o : mark array as readonly --readwrite -w : mark array as readwrite --test -t : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing 3.) Informationen Um die Informationen zum Zustand des RAID zu erhalten verwenden Sie den Befehl --misc # mdadm --misc --detail /dev/md1 /dev/md1: Version : 00.90.00 Creation Time : Tue Nov 7 22:01:16 2006 Raid Level : raid1 Array Size : 3068288 (2.93 GiB 3.14 GB) Device Size : 3068288 (2.93 GiB 3.14 GB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Wed Nov 8 15:42:35 2006 State : active, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 UUID : 4a9a446d:af55e24b:b311aa61:8dc74ed4 Events : 0.12 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 0 0 1 removed Man sieht dass ein RAID 1 mit 3 GB vorhanden ist das sich im Modus "degraded" befindet weil die Platte sdb1 fehlt. 4.) ADD einer Festplatte im degraded Modus Hier ein Beispiel der Befehle um eine Festplatte in einem degraded RAID einzufügen. # mdadm /dev/md1 --manage --add /dev/sdb1 mdadm: hot added /dev/sdb1 Der RAID wird wieder aufgebaut: # cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] read_ahead 1024 sectors md1 : active raid1 sdb1[2] sda1[0] 3068288 blocks [2/1] [U_] [=>...................] recovery = 5.4% (167028/3068288) finish=0.8min speed=55676K/sec md2 : active raid1 sda2[0] 240597376 blocks [2/1] [U_] Nach einigen Minuten ist der Wiederaufbau des RAID beendet: # mdadm --misc --detail /dev/md1 /dev/md1: Version : 00.90.00 Creation Time : Tue Nov 7 22:01:16 2006 Raid Level : raid1 Array Size : 3068288 (2.93 GiB 3.14 GB) Device Size : 3068288 (2.93 GiB 3.14 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Wed Nov 8 16:01:02 2006 State : active Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 UUID : 4a9a446d:af55e24b:b311aa61:8dc74ed4 Events : 0.14 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 8 17 1 active sync /dev/sdb1 Wir machen nun das Gleiche mit md1: # mdadm /dev/md2 --manage --add /dev/sdb2 mdadm: hot added /dev/sdb2 Der RAID wird wieder aufgebaut: # mdadm --misc --detail /dev/md2 /dev/md2: Version : 00.90.00 Creation Time : Tue Nov 7 22:01:16 2006 Raid Level : raid1 Array Size : 240597376 (229.45 GiB 246.37 GB) Device Size : 240597376 (229.45 GiB 246.37 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 2 Persistence : Superblock is persistent Update Time : Wed Nov 8 16:06:43 2006 State : active, degraded, recovering Active Devices : 1 Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 0% complete UUID : e8754328:26f28599:8b834aba:ade37773 Events : 0.10 Number Major Minor RaidDevice State 0 8 2 0 active sync /dev/sda2 1 0 0 1 removed 2 8 18 2 spare /dev/sdb2 # cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] read_ahead 1024 sectors md1 : active raid1 sdb1[1] sda1[0] 3068288 blocks [2/2] [UU] md2 : active raid1 sdb2[2] sda2[0] 240597376 blocks [2/1] [U_] [>....................] recovery = 0.2% (655104/240597376) finish=73.2min speed=54592K/sec unused devices: Überprüfen Sie am Schluss die Grösse Ihres Swap: cat /proc/swaps Filename Type Size Used Priority /dev/sdb3 partition 522104 43984 -1 Sie müssen nun den Swap der Festplatte die Sie formatiert haben wieder dem RAID hinzufügen: mkswap /dev/sda3 swapon -a Mit dem Befehl "free" können Sie sehen dass der gesamte Swapbereich wieder aktiviert ist. |