Como limpiar las cabeceras de unos discos ASM
$ORACLE_HOME/bin/asmcmd afd_label PEPITO /dev/mapper/PEPITOp1 –init
disk /dev/mapper/PEPITOp1 is already provisioned for ASM
Hace poco, preparando una instalación en un cliente, una 12.2 Grid Infrastructure, y habiendo dejado configurados los discos con AFD para la instalación posterior, tuvieron que cambiar las máquinas de cpds y se apagaron para su traslado.
La configuración previa que habíamos hecho era:
[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done
Y los discos se podían ver en:
[root@ctbl109 bin]# cd /dev/oracleafd/disks/ [root@ctbl109 disks]# ls PROADMIN101P1 PROCONTREDO101P1 PRODATADB101P1 PROFRA101P1 PROFRA203P1 PROVOTOCR101P1 PROADMIN102P1 PROCONTREDO102P1 PRODATADB102P1 PROFRA102P1 PROFRA204P1 PROVOTOCR102P1 PROADMIN103P1 PROCONTREDO103P1 PRODATADB103P1 PROFRA103P1 PROFRA205P1 PROVOTOCR201P1 PROADMIN104P1 PROCONTREDO104P1 PRODATADB104P1 PROFRA104P1 PROFRA206P1 PROVOTOCR202P1 PROADMIN201P1 PROCONTREDO201P1 PRODATADB201P1 PROFRA105P1 PROMGTDB101P1 PROADMIN202P1 PROCONTREDO202P1 PRODATADB202P1 PROFRA106P1 PROMGTDB102P1 PROADMIN203P1 PROCONTREDO203P1 PRODATADB203P1 PROFRA201P1 PROMGTDB201P1 PROADMIN204P1 PROCONTREDO204P1 PRODATADB204P1 PROFRA202P1 PROMGTDB202P1
Al volver a encender las máquinas, no estaban los discos:
[root@ctbl109 bin]# cd /dev/oracleafd/disks/ [root@ctbl109 disks]# ls total 0
Y si intentábamos volver a etiquetarlos nos decía que ya estaban:
[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done disk /dev/mapper/PROADMIN101p1 is already provisioned for ASM disk /dev/mapper/PROADMIN102p1 is already provisioned for ASM disk /dev/mapper/PROADMIN103p1 is already provisioned for ASM disk /dev/mapper/PROADMIN104p1 is already provisioned for ASM disk /dev/mapper/PROADMIN201p1 is already provisioned for ASM disk /dev/mapper/PROADMIN202p1 is already provisioned for ASM disk /dev/mapper/PROADMIN203p1 is already provisioned for ASM disk /dev/mapper/PROADMIN204p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO101p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO102p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO103p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO104p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO201p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO202p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO203p1 is already provisioned for ASM disk /dev/mapper/PROCONTREDO204p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb101p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb102p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb103p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb104p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb201p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb202p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb203p1 is already provisioned for ASM disk /dev/mapper/PRODATAdb204p1 is already provisioned for ASM disk /dev/mapper/PROFRA101p1 is already provisioned for ASM disk /dev/mapper/PROFRA102p1 is already provisioned for ASM disk /dev/mapper/PROFRA103p1 is already provisioned for ASM disk /dev/mapper/PROFRA104p1 is already provisioned for ASM disk /dev/mapper/PROFRA105p1 is already provisioned for ASM disk /dev/mapper/PROFRA106p1 is already provisioned for ASM disk /dev/mapper/PROFRA201p1 is already provisioned for ASM disk /dev/mapper/PROFRA202p1 is already provisioned for ASM disk /dev/mapper/PROFRA203p1 is already provisioned for ASM disk /dev/mapper/PROFRA204p1 is already provisioned for ASM disk /dev/mapper/PROFRA205p1 is already provisioned for ASM disk /dev/mapper/PROFRA206p1 is already provisioned for ASM disk /dev/mapper/PROMGTDB101p1 is already provisioned for ASM disk /dev/mapper/PROMGTDB102p1 is already provisioned for ASM disk /dev/mapper/PROMGTDB201p1 is already provisioned for ASM disk /dev/mapper/PROMGTDB202p1 is already provisioned for ASM disk /dev/mapper/PROVOTOCR101p1 is already provisioned for ASM disk /dev/mapper/PROVOTOCR102p1 is already provisioned for ASM disk /dev/mapper/PROVOTOCR201p1 is already provisioned for ASM disk /dev/mapper/PROVOTOCR202p1 is already provisioned for ASM
pero seguían sin aparecer en el /dev/oracleafd/disks, y si no salen ahí, no podemos instalar el asm y configurar los disksgroups.
Probamos a desetiquetarlos y volver a etiquetarlos, y todo seguía igual:
[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_unlabel /dev/mapper/$disco; done [root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done [root@ctbl109 bin]# cd /dev/oracleafd/disks/ [root@ctbl109 disks]# ls total 0
Probamos incluso a particionar otro vez el disco, pero como utilizábamos la misma configuración de particiones, no llegaba a borrar la cabecera del disco y continuábamos sin poder añadirlos al AFD:
[root@ctbl109 mapper]# for disco in `ls -1 /dev/mapper/PRO* | grep -E -v "*1$"`; do echo -e "o\nn\np\n1\n\n\nw" | fdisk $disco; done
Comprobamos que la cabecera seguía teniendo la misma información:
[root@ctbl109 mapper]# od -c -N 64 /dev/mapper/PROADMIN101p1 0000000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 p y 037 { 0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000040 O R C L D I S K P R O A D M I N 0000060 1 0 1 P 1 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000100
Entonces, para probar, procedimos a borrar uno de los discos y comprobamos que la cabecera se limpiaba:
[root@ctbl109 mapper]# dd if=/dev/zero of=/dev/mapper/PROADMIN101p1 bs=4k count=1024 1024+0 registros leídos 1024+0 registros escritos 4194304 bytes (4,2 MB) copiados, 0,0139357 s, 301 MB/s [root@ctbl109 mapper]# od -c -N 64 /dev/mapper/PROADMIN101p1 0000000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0000100
Así que limpiamos todas las cabeceras:
[root@ctbl109 mapper]# for disco in `ls *PRO* `; do dd if=/dev/zero of=/dev/mapper/$disco bs=4k count=1024; done
Y volvimos a configurar los discos para AFD sin problemas:
[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done
Y ya estaban todos listos para la lanzar la instalación:
[root@ctbl109 mapper]# ls /dev/oracleafd/disks/ PROADMIN101P1 PROCONTREDO104P1 PRODATADB203P1 PROFRA204P1 PROADMIN102P1 PROCONTREDO201P1 PRODATADB204P1 PROFRA205P1 PROADMIN103P1 PROCONTREDO202P1 PROFRA101P1 PROFRA206P1 PROADMIN104P1 PROCONTREDO203P1 PROFRA102P1 PROMGTDB101P1 PROADMIN201P1 PROCONTREDO204P1 PROFRA103P1 PROMGTDB102P1 PROADMIN202P1 PRODATADB101P1 PROFRA104P1 PROMGTDB201P1 PROADMIN203P1 PRODATADB102P1 PROFRA105P1 PROMGTDB202P1 PROADMIN204P1 PRODATADB103P1 PROFRA106P1 PROVOTOCR101P1 PROCONTREDO101P1 PRODATADB104P1 PROFRA201P1 PROVOTOCR102P1 PROCONTREDO102P1 PRODATADB201P1 PROFRA202P1 PROVOTOCR201P1 PROCONTREDO103P1 PRODATADB202P1 PROFRA203P1 PROVOTOCR202P1
Añadiendo valor con Arumel!!