Linux – Regenerar RAID con mdadm

Recibimos alerta de mdadm.conf, alertando de un fallo en el RAID

Comprobamos estado del RAID por software

# cat /proc/mdstat

md0 : active raid6 sda2[0] sdc2[2] sdd2[3] sde2[4] sdf2[5] 3839951872 blocks level 6, 256k chunk, algorithm 2 [6/5] [U_UUUU]

El problema, como se ve, está en el volúmen md0. Hacemos consulta sobre ese volúmen más a fondo

# mdadm --query --detail /dev/md0


/dev/md0:
Version : 0.90
Creation Time : Fri Nov 28 03:38:53 2008
Raid Level : raid6
Array Size : 3839951872 (3662.06 GiB 3932.11 GB)
Used Dev Size : 959987968 (915.52 GiB 983.03 GB)
Raid Devices : 6
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Wed Apr 20 14:38:41 2011
State : active, degraded
Active Devices : 5
Working Devices : 5
Failed Devices : 0
Spare Devices : 0

Chunk Size : 256K

UUID : 1fc20881:3dfc0349:86238ebd:efce0154
Events : 0.6445927

Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
1 0 0 1 removed
2 8 34 2 active sync /dev/sdc2
3 8 50 3 active sync /dev/sdd2
4 8 66 4 active sync /dev/sde2
5 8 82 5 active sync /dev/sdf2

Podemos apreciar que /dev/sdb2 es el que está afectando al conjunto del RAID en el volúmen md0, de level Raid 6.

Comprobamos estado del disco duro /dev/sdb

# sfdisk -l /dev/sdb

Disk /dev/sdb: 121601 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sdb1 * 0+ 2087 2088- 16771828+ 82 Linux swap / Solaris
/dev/sdb2 2088 121600 119513 959988172+ fd Linux raid autodetect
/dev/sdb3 0 - 0 0 0 Empty
/dev/sdb4 0 - 0 0 0 Empty

Reañadimos la partición sdb2 al conjunto del RAID y comprobamos que se regenera el mirroring

# mdadm -a /dev/md0 /dev/sdb2
mdadm: re-added /dev/sdb2

# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] md0 : active raid6 sdb2[6] sda2[0] sdc2[2] sdd2[3] sde2[4] sdf2[5] 3839951872 blocks level 6, 256k chunk, algorithm 2 [6/5] [U_UUUU] [>....................] recovery = 0.5% (5185648/959987968) finish=426.8min speed=37279K/sec

En este caso, tendremos que vigilar si el RAID se regenerá correctamente porque en caso contrario, será necesaria un reemplazo del disco físico.

Configurar dispositivos físicos zero-superblock

$ mdadm –zero-superblock /dev/sdb1

Auto-Read-only mdadm

Si nuestro raid tiene este aspecto

md1 : active (auto-read-only) raid10 sda2[0] sdd2[3] sdc2[2] sdb2[1]
        7810048 blocks super 1.2 512K chunks 2 near-copies [4/4]  [UUUU]

hemos de ejecutar lo siguiente para forzar a mdadm a regenerar el raid

$ mdadm --readwrite /dev/md1
$ watch -n 1 cat /proc/mdstat

Forzar reparación

To run a “sync” check:
echo check > /sys/block/mdX/md/sync_action
To run a “repair” check:
echo repair > /sys/block/mdX/md/sync_action

Links
http://systemadmin.es/2011/02/anadir-o-quitar-discos-en-fallo-de-un-raid-por-software
http://david.toribio.eu/2010/01/03/sustituir-un-disco-en-un-entorno-raid-linux/
http://wiki.linuxservertech.com/index.php?action=artikel&cat=7&id=11&artlang=en
http://wiki.eri.ucsb.edu/sysadm/RAID
http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/
http://dev.bizo.com/2012/07/mdadm-device-or-resource-busy.html
http://www.thomas-krenn.com/en/wiki/Mdadm_recovery_and_resync
http://agix.com.au/blog/?p=1520
http://www.geekride.com/activating-an-inactive-raid-array/
http://blog.laimbock.com/2014/04/01/how-to-replace-a-failed-disk-with-linux-software-raid-mdadm/

How to force a “sync” or “repair” check of mdadm arrays

Eliminar RAID
http://superuser.com/questions/606751/how-to-remove-linux-software-raid-md-device
http://chrisspeck.com/2012/01/completely-removing-a-mdadm-raid-array-in-ubuntu/

Mdadm Cheat Sheet

2 thoughts on “Linux – Regenerar RAID con mdadm

Leave a Reply

Your email address will not be published. Required fields are marked *