/dev/hdb und /dev/hdd sollen zu einem Raid-Verbund zusammen geführt werden
cfdisk /dev/hdb cfdisk /dev/hdd
beidemale die Partitionen kreeieren und den Partitionstyp auf Linux raid autodetect setzen.
apt-get install mdadm mdadm -v --create /dev/md0 --level=mirror --raid-devices=2 /dev/hdb1 /dev/hdd1 mdadm: size set to 312568576K mdadm: array /dev/md0 started.
Synchronisationsvorgang beobachten:
watch cat /proc/mdstat Every 2,0s: cat /proc/mdstat Mon Jul 23 19:49:27 2007 Personalities : [raid1] md0 : active raid1 hdd1[1] hdb1[0] 312568576 blocks [2/2] [UU] [>....................] resync = 2.4% (7549824/312568576) finish=154.7min speed=32855K/sec unused devices: <none>
filesystem erzeugen:
[root] mkfs.ext3 /dev/md0 mke2fs 1.40-WIP (14-Nov-2006) Dateisystem-Label= OS-Typ: Linux Blockgröße=4096 (log=2) Fragmentgröße=4096 (log=2) 39075840 Inodes, 78142144 Blöcke 3907107 Blöcke (5.00%) reserviert für den Superuser erster Datenblock=0 Maximum filesystem blocks=0 2385 Blockgruppen 32768 Blöcke pro Gruppe, 32768 Fragmente pro Gruppe 16384 Inodes pro Gruppe Superblock-Sicherungskopien gespeichert in den Blöcken: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616 Schreibe Inode-Tabellen: 173/2385
/etc/fstab ergänzen:
/dev/md0 /media/data ext3 defaults 0 2 #Raid1 Verbund aus hdb und hdd
hdd wurde entfernt:
mdadm --detail/dev/md0 /dev/md0: Version : 00.90.03 Creation Time : Mon Jul 23 19:45:35 2007 Raid Level : raid1 Array Size : 312568576 (298.09 GiB 320.07 GB) Device Size : 312568576 (298.09 GiB 320.07 GB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 0 Persistence : Superblock is persistent Update Time : Tue Jul 24 00:10:52 2007 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 UUID : fbc5f702:5593f6b3:a3e02906:f87e756b Events : 0.44 Number Major Minor RaidDevice State 0 3 65 0 active sync /dev/hdb1 1 0 0 1 removed
hdd wurde wieder hinzugefügt und mittels folgendem Befehl wieder aktiviert
mdadm /dev/md0 -a /dev/hdd1 mdadm: re-added /dev/hdd1
mdadm --detail /dev/md0 /dev/md0: Version : 00.90.03 Creation Time : Mon Jul 23 19:45:35 2007 Raid Level : raid1 Array Size : 312568576 (298.09 GiB 320.07 GB) Device Size : 312568576 (298.09 GiB 320.07 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 0 Persistence : Superblock is persistent Update Time : Tue Jul 24 00:10:52 2007 State : clean, degraded, recovering Active Devices : 1 Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 0% complete UUID : fbc5f702:5593f6b3:a3e02906:f87e756b Events : 0.44 Number Major Minor RaidDevice State 0 3 65 0 active sync /dev/hdb1 1 22 65 1 spare rebuilding /dev/hdd1
der rebuild-Prozess lässt sich mit folgendem Befehl beobachten:
[root] watch cat /proc/mdstat Every 2,0s: cat /proc/mdstat Tue Jul 24 00:23:35 2007 Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 hdd1[1] hdb1[0] 312568576 blocks [2/1] [U_] [>....................] recovery = 2.2% (7149120/312568576) finish=151.0min speed=33698K/sec unused devices: <none>
Bestehendes Raid-System auf anderem System oder mit Knoppix einbinden:
modprobe md mdadm -A /dev/md0 /dev/sda1 /dev/sdb1