Mdadm
Herramienta
La herramienta mdadm permite gestionar las particiones RAID por software en Linux.
Reconstruir un espejo
Cuando un espejo se rompe en el fichero /proc/mdstat se ve algo parecido a:
# cat /proc/mdstat Personalities : [raid1] md1 : active raid1 sda2[0] 1959808 blocks [2/1] [U_] md2 : active raid1 sda3[0] 9775488 blocks [2/1] [U_] md3 : active raid1 sda4[0] 66011008 blocks [2/1] [U_] md0 : active raid1 sdb1[1] sda1[0] 401472 blocks [2/2] [UU] unused devices: <none>
Para comprobar el estado utilizamos el comando siguiente:
mdadm -D /dev/md3 /dev/md3: Version : 00.90.03 Creation Time : Tue Dec 5 03:42:23 2006 Raid Level : raid1 Array Size : 66011008 (62.95 GiB 67.60 GB) Device Size : 66011008 (62.95 GiB 67.60 GB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 3 Persistence : Superblock is persistent Update Time : Tue Dec 16 05:23:27 2008 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 UUID : b274bb08:3c5c8c59:958a7328:9e8d7554 Events : 0.9538 Number Major Minor RaidDevice State 0 8 4 0 active sync /dev/sda4 1 0 0 1 removed
Para recomponer los espejos se utiliza el siguiente comando:
mdadm /dev/md2 -a /dev/sdb3
Si nos da un mensage de error que /dev/sdb3 esta ocupado es que lo tenemos que quitar del espejo el comando es el siguiente:
mdadm --manage /dev/md2 -r /dev/sdb3
El estado mientras se reconstruye se ve con los datos siguientes:
mdadm -D /dev/md2 /dev/md2: Version : 00.90.03 Creation Time : Tue Dec 5 03:42:13 2006 Raid Level : raid1 Array Size : 9775488 (9.32 GiB 10.01 GB) Device Size : 9775488 (9.32 GiB 10.01 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 2 Persistence : Superblock is persistent Update Time : Tue Dec 16 14:11:59 2008 State : clean, degraded, recovering Active Devices : 1 Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 66% complete UUID : ce26eb8e:b21d0cd1:8d1864ca:dbf13d60 Events : 0.693062 Number Major Minor RaidDevice State 0 8 3 0 active sync /dev/sda3 2 8 19 1 spare rebuilding /dev/sdb3
Un vez terminado se aprecia lo siguiente: mdadm -D /dev/md2
/dev/md2: Version : 00.90.03 Creation Time : Tue Dec 5 03:42:13 2006 Raid Level : raid1 Array Size : 9775488 (9.32 GiB 10.01 GB) Device Size : 9775488 (9.32 GiB 10.01 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 2 Persistence : Superblock is persistent Update Time : Tue Dec 16 14:13:57 2008 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 UUID : ce26eb8e:b21d0cd1:8d1864ca:dbf13d60 Events : 0.693068 Number Major Minor RaidDevice State 0 8 3 0 active sync /dev/sda3 1 8 19 1 active sync /dev/sdb3
Referencias
--Daniel Simao 12:48 16 dic 2008 (UTC)