Thursday, July 5. 2007
Ich hab leider kein einfaches schnelles howto gefunden, deshalb schreibe ich einfach mal, was ich machen musste, um 2 Platten mit redundanten SAS-Datenpfaden zu einem Software Raid1 zusammenzufuegen
Im Normalfall meldet sich jede SAS-Platte als 2 Festplatten (hier sdc, sde bzw. sdb und sdd).
/dev/sdb + /dev/sdd -> dm-0 +
/dev/sdc + /dev/sde -> dm-1 -> md0
Mit dem Befehl multipath werden diese beiden Devices zusammengefügt und dem Devicemapper bekannt gemacht.
test6:~ # multipath -l
3500000e01585a130dm-1 FUJITSU,MAX3147RC
[size=137G][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][active]
\_ 2:0:1:0 sdc 8:32 [active][undef]
\_ round-robin 0 [prio=0][enabled]
\_ 2:0:4:0 sde 8:64 [active][undef]
3500000e01585a190dm-0 FUJITSU,MAX3147RC
[size=137G][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][active]
\_ 2:0:0:0 sdb 8:16 [active][undef]
\_ round-robin 0 [prio=0][enabled]
\_ 2:0:3:0 sdd 8:48 [active][undef]
test6:~ # dmsetup ls
3500000e01585a130 (253, 1)
3500000e01585a190 (253, 0)
test6:~ # dmsetup info
Name: 3500000e01585a130
State: ACTIVE
Tables present: LIVE
Open count: 1
Event number: 1
Major, minor: 253, 1
Number of targets: 1
UUID: mpath-3500000e01585a130
Name: 3500000e01585a190
State: ACTIVE
Tables present: LIVE
Open count: 1
Event number: 1
Major, minor: 253, 0
Number of targets: 1
UUID: mpath-3500000e01585a190
Die beiden Platten kann man nun zu einem Raid1 zusammenfassen, formatieren und mounten.
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/dm-0 /dev/dm-1
mke2fs -j /dev/md0
mount /dev/md0 /raid
rebootfest machen:
chkconfig --add multipathd
chkconfig --add boot.multipath
chkconfig --add mdadmd
chkconfig --add boot.md
test6:~ # cat /etc/mdadm.conf
DEVICE /dev/dm-*
ARRAY /dev/md0 num-devices=2 devices=/dev/dm-0,/dev/dm-1
Programme aus dem Paket multipath:
- multipath: scans the system for multipathed devices, assembles them, updates the device-mapper's maps
- multipathd: waits for maps events and then executes multipath
- devmap-name: provides a meaningful device to udev for devmapps
- kpartx: maps linear devmaps to device partitions
Weitere Infos mit:
test6:~ # devmap_name 253 1
3500000e01585a130
test6:~ # kpartx_id 253 0
ID_DM_TABLE=mpath
ID_DM_NAME=3500000e01585a190
ID_DM_TYPE=scsi
test6:~ # dmsetup table
3500000e01585a130: 0 287277984 multipath 0 0 2 1 round-robin 0 1 1 8:32 1000 round-robin 0 1 1 8:64 1000
3500000e01585a190: 0 287277984 multipath 0 0 2 1 round-robin 0 1 1 8:16 1000 round-robin 0 1 1 8:48 1000
test6:~ # cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4]
md0 : active raid6 dm-5[5] dm-4[4] dm-3[3] dm-2[2] dm-1[1] dm-0[0]
574555648 blocks level 6, 64k chunk, algorithm 2 [6/6] [UUUUUU]
[=======>.............] resync = 36.3% (52195040/143638912) finish=28.5min speed=53356K/sec
unused devices: