Friday, June 23, 2017

Creating ASM disks using ASM Filter Driver (ASMFD)

Starting we can use ASM Filter Drive (ASMFD) to create ASM disks to be used for ASM diskgroups. I have already explain in this article that how we configure ASMFD during GI installation, and this article for migration from ASMLib to ASMFD. In this article I will show you how to create/add new ASM disks using ASMFD so that we can use them for existing or new diskgroups.
Currently I have a disk /dev/sdb1 that is already configured using ASMFD, and now I have a new physical disk /dev/sdc1 that I will be configuring using ASMFD. On asmcmd prompt, if you issue command “help”, you will see list of options starting with “afd” and all these options are available for using ASM Filter Driver

afd_configure, afd_deconfigure, afd_di, afd_dsget, afd_dsset, afd_filter, afd_label, afd_lsdsk, afd_lslbl, afd_refresh,  afd_scan, afd_state, afd_unlabel
You can further issue help command for each of these options to find out the detailed working of that option.
ASMCMD> help afd_label
        To set the given label to the specified disk

        afd_label <label> <disk> [--rename | --migrate] [--init]

        The options for the afd_label command are described below.
        '--init' option is not allowed if AFD is already loaded.

      label                 - label for the disk
      disk                  - disk path
      --rename              - to relabel a disk that was labeled earlier
      --migrate             - to label a disk that was provisioned for ASM
      --init                - to set AFD label during initialize stage

        The following example labels a disk /dev/sdq with label DATA1.

        ASMCMD [+] >afd_label DATA1 /dev/sdq

See Also
       afd_unlabel afd_lsdsk
I will be using afd_label option to label my new disk so that it can be used by ASM.
As root, execute following command
[root@salman11 disks]# /u01/app/12.2.0/grid/bin/asmcmd afd_label DATA2 /dev/sdc1
[root@salman11 disks]# /u01/app/12.2.0/grid/bin/asmcmd afd_lslbl
Label                     Duplicate  Path
DATA                                  /dev/sdb1
DATA2                                 /dev/sdc1

-- Labeled disks are also visible at OS level jut like previously we had /dev/oracleasm directory to view disks labeled using ASMLib

[root@salman11 disks]# ls -l /dev/oracleafd/disks/
total 8
-rwxrwx---. 1 grid oinstall 10 Mar 22 12:38 DATA
-rwxrwx---. 1 grid oinstall 10 Mar 22 13:27 DATA2
Immediately after labelling, disk can be seen under V$ASM_DISK view and can be made part of a diskgroup. Log in as SYSASM and execute following. DATA2 is the newly labelled disk.

SQL> conn sys as sysasm
Enter password:
SQL> select path from v$asm_disk;


SQL>  alter diskgroup data add disk 'AFD:DATA2';

Diskgroup altered.
If disk is still not visible in V$ASM_DISK, you can execute “afd_scan” and disk should be visible now.
Removing Labels of Disk(s)
If you want to remove a disk from ASM, drop it from the ASM diskgroup first (if it is part of an ASM diskgroup), and then un-label it using ASMFD

-- Drop disk from diskgroup if disk is part of a diskgroup (connect as SYSASM).

SQL> alter diskgroup data drop disk DATA2;

Diskgroup altered.
-- As root, unlabel the disk
[root@salman11 disks]# /u01/app/12.2.0/grid/bin/asmcmd afd_unlabel DATA2
[root@salman11 disks]# /u01/app/12.2.0/grid/bin/asmcmd afd_lslbl
Label                     Duplicate  Path
DATA                                  /dev/sdb1

No comments:

Post a Comment