How to clean the ASM disks’ headers

 

$ORACLE_HOME/bin/asmcmd afd_label PEPITO /dev/mapper/PEPITOp1 –init
disk /dev/mapper/PEPITOp1 is already provisioned for ASM

 

Recently, we were preparing an installation Grid Infrastructure 12.2, and we had already ready the disks with AFD for the later installation but in that moment, they had to change the machines between sites and turn them off for moving them.

The previous configuration was:

[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done

 

You could see the disks in:

[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

 

We lost the disks once turn the machines on:

[root@ctbl109 bin]# cd /dev/oracleafd/disks/

[root@ctbl109 disks]# ls

total 0

 

if we tried labeled again, we received that disk is already provisioned:

[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

 

but the disks weren’t in the path /dev/oracleafd/disks.

So we tried to unlabel and label the disks again but the problem was the same:

[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

 

We even tried to partition the disks again, but as it was the same configuration with de partition table, the disk’s header permained equal:

[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

 

We checked the information in the header:

[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

 

Then we decided to test with one of the disks, cleaned its header:

[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

 

So we cleaned all:

[root@ctbl109 mapper]# for disco in `ls *PRO* `; do dd if=/dev/zero of=/dev/mapper/$disco bs=4k count=1024; done

 

and reconfigured the disks again:

[root@ctbl109 mapper]# for disco in `ls *PRO*p1 `; do $ORACLE_HOME/bin/asmcmd afd_label $disco /dev/mapper/$disco --init; done

 

Now, you could see the disks in the correct path:

[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

 

 

Adding value with Arumel!!