die WD15EARS Festplatten haben 4k Sektoren, deswegen muss man fdisk mit -c starten um den DOS-kombatiblen Modus abzuschalten
root@webis6:/media# fdisk -cu /dev/sdb Command (m for help): p Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d8765 Device Boot Start End Blocks Id System /dev/sdb1 63 2930272064 1465136001 83 Linux
Command (m for help): d Selected partition 1 Command (m for help): p Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d8765 Device Boot Start End Blocks Id System
neue Partition mit Typ fd (Linux RAID) anlegen
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (2048-2930277167, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2930277167, default 2930277167): Using default value 2930277167 Command (m for help): p Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d8765 Device Boot Start End Blocks Id System /dev/sdb1 2048 2930277167 1465137560 83 Linux Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d8765 Device Boot Start End Blocks Id System /dev/sdb1 2048 2930277167 1465137560 fd Linux raid autodetect Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
so sollte die Festplatte dann aussehen:
root@webis6:/media# fdisk -lu /dev/sdb Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 81 heads, 63 sectors/track, 574226 cylinders, total 2930277168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d8765 Device Boot Start End Blocks Id System /dev/sdb1 2048 2930277167 1465137560 fd Linux raid autodetect
mit partprobe die Partitionstabelle neu einlesen, sonst gibt es eventuell Probleme
root@webis6:/media# partprobe
root@webis6:/media# apt-get install mdadm
RAID5 über /dev/sdb1 /dev/sdc1 /dev/sdd1 anlegen
root@webis6:/media# mdadm --create --verbose /dev/md0 \ --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 64K mdadm: size set to 1465137472K mdadm: array /dev/md0 started.
mit watch -n.1 cat /proc/mdstat kann man den Process des syncen beobachten
root@webis6:/media# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md0 : active raid5 sdd1[3] sdc1[1] sdb1[0] 2930274944 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_] [>....................] recovery = 0.2% (3185152/1465137472) finish=333.2min speed=73108K/sec unused devices:
jetzt noch das neue Raid in die Datei /etc/mdadm/mdadm.conf am ende Eintragen (spares=1 und metadata löschen!
root@webis6:/media# mdadm --detail --scan ARRAY /dev/md0 level=raid5 num-devices=3 metadata=00.90 spares=1 UUID=4149b068:e994f76b:464f9f15:8f60fb38
root@webis2:/media# mdadm -G /dev/md0 -binternal mdadm: metadata format 00.90 unknown, ignored. root@webis2:/media# cat /proc/mdstat Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid5 sdd1[2] sdc1[1] 2930274944 blocks level 5, 64k chunk, algorithm 2 [3/2] [_UU] bitmap: 175/175 pages [700KB], 4096KB chunk unused devices:
in /etc/mdadm/mdadm.conf unter DEVICE anstatt partitions die direkten Partitionen eintragen /dev/sdb1 /dev/sdc1 /dev/sdd1
Wenn das RAID nicht startet, hilft eventuell neu erstellen und die defekte Festplatte als missing einzutragen. Die Daten gehen dabei nicht verloren.
mit mdadm -f markiert man ein Laufwerk als FAULTY, mit -r entfernt man es aus dem Verbund. Das ist aber anscheind erst möglich wenn 1x initial gesynct wurde. Durch den "Trick" mit dem neu-erstellen mit "missing" drives, kann man sich das syncen sparen (!?!?!)
eine andere Möglichkeit, dass sich die UUID geändert haben, also /etc/mdadm/mdadm.conf mit den neuen Daten updaten
# mdadm --detail --scan >> /etc/mdadm/mdadm.conf
siehe: http://en.wikipedia.org/wiki/Mdadm#Increasing_RAID5_Performance (scheint nicht viel zu bringen - nicht im Detail getestet)
http://en.wikipedia.org/wiki/Mdadm http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch26_:_Linux_Software_RAID
https://raid.wiki.kernel.org/index.php/Linux_Raid