The views expressed on this blog are my own and do not necessarily reflect the views of Oracle

January 9, 2012

ASM file number 9

The attributes directory - ASM file number 9 - contains metadata about disk group attributes. The attributes directory exists only in disk groups where COMPATIBLE.ASM is 11.1 or higher.

Disk group attributes were introduced in ASM version 11.1[1] and can be used to fine tune the disk group properties. It is worth noting that some attributes can be set only at the time the disk group is created, while other attributes can be set at any time. Some attributes might be stored in the disk header, for example the AU_SIZE, while some other attributes, for example COMPATIBLE.ASM, can be stored either in the partnership and status table or in the disk header (depending on the ASM version).

Public attributes

Most attributes are stored in the attributes directory and are externalized via V$ASM_ATTRIBUTE view. Let's have a look at disk group attributes for all my disk groups.

SQL> SELECT "Group name", "Attribute", a.value "Value"
FROM v$asm_diskgroup g, v$asm_attribute a
WHERE g.group_number=a.group_number and not like 'template%';

Group name   Attribute                                        Value
------------ ------------------------------------------------ ----------------
ACFS         disk_repair_time                                 3.6h
             au_size                                          1048576
             access_control.umask                             026
             access_control.enabled                           TRUE
             cell.smart_scan_capable                          FALSE
             compatible.rdbms                                 11.2
             sector_size                                      512
DATA         access_control.enabled                           TRUE
             cell.smart_scan_capable                          FALSE
             compatible.rdbms                                 11.2
             sector_size                                      512
             au_size                                          1048576
             disk_repair_time                                 3.6h
             access_control.umask                             026

One attribute I can modify at any time is the disk repair timer. Let's use asmcmd to do that for disk group DATA.

$ asmcmd setattr -G DATA disk_repair_time '8.0h'

$ asmcmd lsattr -lm disk_repair_time
Group_Name  Name              Value  RO  Sys
ACFS        disk_repair_time  3.6h   N   Y
DATA        disk_repair_time  8.0h   N   Y

Hidden attributes

Locate the attributes directory.

SQL> SELECT x.disk_kffxp "Disk#",
 x.xnum_kffxp "Extent",
 x.au_kffxp "AU", "Disk name"
FROM x$kffxp x, v$asm_disk_stat d
WHERE x.group_kffxp=d.group_number
 and x.disk_kffxp=d.disk_number
 and d.group_number=2
 and x.number_kffxp=9
ORDER BY 1, 2;

     Disk#     Extent         AU Disk name
---------- ---------- ---------- ------------------------------
         0          0       1146 ASMDISK1
         1          0       1143 ASMDISK2
         2          0       1150 ASMDISK3

Now check out all attributes with kfed.

$ kfed read /dev/oracleasm/disks/ASMDISK3 aun=1150 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                           23 ; 0x002: KFBTYP_ATTRDIR
kfede[0].entry.incarn:                1 ; 0x024: A=1 NUMM=0x0
kfede[0].entry.hash:                  0 ; 0x028: 0x00000000
kfede[0].entry.refer.number: 4294967295 ; 0x02c: 0xffffffff
kfede[0].entry.refer.incarn:          0 ; 0x030: A=0 NUMM=0x0
kfede[0].name:         disk_repair_time ; 0x034: length=16
kfede[0].value:                    8.0h ; 0x074: length=4

Fields kfede[i] will have the disk group attribute names and values. Let's look at all of them:

$ kfed read /dev/oracleasm/disks/ASMDISK3 aun=1150 | egrep "name|value"
kfede[0].name:         disk_repair_time ; 0x034: length=16
kfede[0].value:                    8.0h ; 0x074: length=4
kfede[1].name:       _rebalance_compact ; 0x1a8: length=18
kfede[1].value:                    TRUE ; 0x1e8: length=4
kfede[2].name:            _extent_sizes ; 0x31c: length=13
kfede[2].value:                  1 4 16 ; 0x35c: length=6
kfede[3].name:           _extent_counts ; 0x490: length=14
kfede[3].value:   20000 20000 214748367 ; 0x4d0: length=21
kfede[4].name:                        _ ; 0x604: length=1
kfede[4].value:                       0 ; 0x644: length=1
kfede[5].name:                  au_size ; 0x778: length=7
kfede[5].value:               ; 0x7b8: length=9
kfede[6].name:              sector_size ; 0x8ec: length=11
kfede[6].value:               ; 0x92c: length=9
kfede[7].name:               compatible ; 0xa60: length=10
kfede[7].value:               ; 0xaa0: length=9
kfede[8].name:                     cell ; 0xbd4: length=4
kfede[8].value:                   FALSE ; 0xc14: length=5
kfede[9].name:           access_control ; 0xd48: length=14
kfede[9].value:                   FALSE ; 0xd88: length=5

This gives us a glimpse into the hidden (underscore) disk group attributes. We can see that the _rebalance_compact=TRUE. That is the attribute to do with the compacting phase of the disk group rebalance. We also see how extent size will grow (_extent_sizes) - initial size will be 1 AU, then 4 AU and finally 16 AU. And _extent_counts shows the breaking points for the extent size growth - first 20000 extents will be 1 AU in size, next 20000 will be 4 AU and the rest will be 16 AU.


Disk group attributes can be used to fine tune the disk group properties. Most attributes are stored in the attributes directory and are externalized via V$ASM_ATTRIBUTE view.

[1] In ASM version prior to 11.1 it was possible to create a disk group with user specified allocation unit size. That was done via hidden ASM initialization parameter _ASM_AUSIZE. While technically that was not a disk group attribute, it served the same purpose as the AU_SIZE attribute in ASM version 11.1 and later.