Oracle ASM Filter Driver is a new way to bind the disk with a permanent path, instead of the using of asmlib or udev. And, additionally, it provides the protection of the disk device from the crazy operations.

  1. ASMCMD> afd_state
  2. ASMCMD-9526: The AFD state is LOADED and filtering is ENABLED on host database01
  3.  
  4. ASMCMD> afd_lsdsk
  5. ——————————————————————————–
  6. Label Filtering Path
  7. ================================================================================
  8. CRSDG1 ENABLED /dev/asm-sdd
  9. CRSDG2 ENABLED /dev/asm-sdc
  10. CRSDG3 ENABLED /dev/asm-sdb
  11. MGMT1 ENABLED /dev/asm-sdj

Enable:
The simplest way is to choose it during the installment of Grid.
We can also enable it by using afd_configure in asmcmd.( with CRS off)

Label new disk:

  1. /u01/app/12.2.0/grid/bin/asmcmd afd_label DAT01 /dev/sde

Label exist disk:

  1. /u01/app/12.2.0/grid/bin/asmcmd afd_label CRSDG1 /dev/sdd migrate

Unlabel:

  1. /u01/app/12.2.0/grid/bin/asmcmd afd_unlabel DATA1

Scan and List( like asmlib )

  1. asmcmd afd_lsdsk
  2. asmcmd afd_scan

The status in v$asm_disk

  1. 1* select NAME, PATH, mount_status from v$asm_disk
  2. SQL> /
  3.  
  4. NAME PATH MOUNT_S
  5. ———- ——————– ——-
  6. /dev/asm-sdj IGNORED
  7. /dev/asm-sdc IGNORED
  8. /dev/asm-sdd IGNORED
  9. /dev/asm-sdb IGNORED
  10. CRSDG1 AFD:CRSDG1 CACHED
  11. CRSDG2 AFD:CRSDG2 CACHED
  12. MGMT1 AFD:MGMT1 CACHED
  13. CRSDG3 AFD:CRSDG3 CACHED
  14.  
  15. 8 rows selected.

Filter — rewrite the disk

  1. [root@database01 ~]# dd if=/dev/zero of=/dev/oracleafd/disks/CRSDG1 bs=128 count=8000
  2. 8000+0 records in
  3. 8000+0 records out
  4. 1024000 bytes (1.0 MB) copied, 0.0274736 s, 37.3 MB/s
  5.  
  6. read the disk and find the data has been cleaned up
  7. [root@database01 ~]# dd if=/dev/oracleafd/disks/CRSDG1 |od -xv|tail -n 10
  8. 2000+0 records in
  9. 2000+0 records out
  10. 1024000 bytes (1.0 MB) copied, 0.358082 s, 2.9 MB/s
  11. 3717560 0000 0000 0000 0000 0000 0000 0000 0000
  12. 3717600 0000 0000 0000 0000 0000 0000 0000 0000
  13. 3717620 0000 0000 0000 0000 0000 0000 0000 0000
  14. 3717640 0000 0000 0000 0000 0000 0000 0000 0000
  15. 3717660 0000 0000 0000 0000 0000 0000 0000 0000
  16. 3717700 0000 0000 0000 0000 0000 0000 0000 0000
  17. 3717720 0000 0000 0000 0000 0000 0000 0000 0000
  18. 3717740 0000 0000 0000 0000 0000 0000 0000 0000
  19. 3717760 0000 0000 0000 0000 0000 0000 0000 0000
  20. 3720000
  21.  
  22. after reboot, data is remain
  23. [root@database01 ~]# dd if=/dev/oracleafd/disks/CRSDG1 |od -xv|tail -n 10
  24. 0+1 records in
  25. 0+1 records out
  26. 13 bytes (13 B) copied, 3.3587e-05 s, 387 kB/s
  27. 0000000 642f 7665 612f 6d73 732d 6464 000a
  28. 0000015
  29.  
  30. the disk is still a member of votedisk
  31. [grid@database01 ~]$ crsctl query css votedisk
  32. ## STATE File Universal Id File Name Disk group
  33. —– —————– ——— ———
  34. 1. ONLINE 88f23183af1f4fdbbf65f93a8b927f27 (AFD:CRSDG1) [CRSDG]
  35. 2. ONLINE c761b16740504fd0bfdc280f4cbef571 (AFD:CRSDG2) [CRSDG]
  36. 3. ONLINE 24e27d7bf82f4fa4bf8bd69dd3fde7e9 (AFD:CRSDG3) [CRSDG]
  37. Located 3 voting disk(s).

The Path of Disk

  1. [grid@database01 ~]$ ls -l /dev/oracleafd/disks
  2. total 16
  3. -rwxrwx 1 grid oinstall 13 Jun 11 22:54 CRSDG1
  4. -rwxrwx 1 grid oinstall 13 Jun 11 22:54 CRSDG2
  5. -rwxrwx 1 grid oinstall 13 Jun 11 22:54 CRSDG3
  6. -rwxrwx 1 grid oinstall 13 Jun 11 22:54 MGMT1