Traditional disk based storage systems use a sector size of 512 bytes, some all-flash-arrays use 4K sectors sizes, but it’s not something we generally consider, do you know what you are using ?
If you’re not sure you may want to check-out now of my recent posts on how to check disk sector sizes from the Linux OS and Oracle ASM.
So now, you know what we are using, do we have the flexibility to try out different sector sizes ?
In my lab I am using Pure Storage FlashArray which present storage as 512b, we can see this using blockdev command, for example.
[oracle@z-oracle ~]$ blockdev -v --getss /dev/oracleasm/dg_oradata3 get logical block (sector) size: 512 [oracle@z-oracle ~]$ blockdev -v --getpbsz /dev/oracleasm/dg_oradata3 get physical block (sector) size: 512
So what happens if we try and create an ASM diskgroup with a 4k sector size ?
Oracle ASM performs checks whenever a diskgroup is created, altered or added to ensure that the same sector size is being used for all disks in the diskgroup.
This validation is also performed when the diskgroup is mounted. If the disk sector sizes vary within a group, or for some reason Oracle ASM cannot verify the disk sector size, then whichever operation is being performed will fail.
We can disable these checks with the “_disk_sector_size_override” parameter.
Note: Oracle underscore parameters should only be used in Production under the direction of Oracle Support.
SQL> show parameter "_disk_sector_size_override"
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_disk_sector_size_override boolean TRUE
Having confirmed validation is disabled we are now free to create a 4K diskgroup on the 512b disk.
SQL> create diskgroup DATA_4K EXTERNAL REDUNDANCY DISK '/dev/oracleasm/dg_oradata3' ATTRIBUTE 'au_size'='4M', 'sector_size'='4096';
Diskgroup created.
We can confirm sector_size and logical_sector_size of the newly created diskgroup with v$asm_diskgroup view, for example.
SQL> select name, state, sector_size, logical_sector_size, group_number from v$asm_diskgroup;
NAME STATE SECTOR_SIZE LOGICAL_SECTOR_SIZE GROUP_NUMBER
------------------------------ ----------- ----------- ------------------- ------------
...
DATA_4K MOUNTED 4096 4096 6
Now, what happens if you want to change the diskgroup to use a logical_sector_size of 512b ?
SQL> ALTER DISKGROUP DATA_4K SET ATTRIBUTE 'logical_sector_size'='512';
ALTER DISKGROUP DATA_4K SET ATTRIBUTE 'logical_sector_size'='512'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15242: could not set attribute logical_sector_size
ORA-15238: 512 is not a valid value for attribute logical_sector_size
ORA-15221: ASM operation requires compatible.asm of 12.2.0.0.0 or higher
From the above we can see before we can change the sector_size attributes we need to change the compatible.asm to 12.2.0.0.0 or higher.
SQL> ALTER DISKGROUP DATA_4K SET ATTRIBUTE 'compatible.asm' = '12.2.0.0.0';
Diskgroup altered.
SQL> ALTER DISKGROUP DATA_4K SET ATTRIBUTE 'logical_sector_size'='512';
Diskgroup altered.
If we now re-query v$asm_diskgroup we can confirm the logical_sector_size has been updated.
SQL> select name, state, sector_size, logical_sector_size, group_number from v$asm_diskgroup;
NAME STATE SECTOR_SIZE LOGICAL_SECTOR_SIZE GROUP_NUMBER
------------------------------ ----------- ----------- ------------------- ------------
...
DATA_4K MOUNTED 4096 512 6
We can repeat this for the physical sector size.
SQL> ALTER DISKGROUP DATA_4K SET ATTRIBUTE 'sector_size'='512';
Diskgroup altered.
SQL> select name, state, sector_size, logical_sector_size, group_number from v$asm_diskgroup;
NAME STATE SECTOR_SIZE LOGICAL_SECTOR_SIZE GROUP_NUMBER
------------------------------ ----------- ----------- ------------------- ------------
...
DATA_4K MOUNTED 512 512 6
From the OS we can use the ASM command line utility (asmcmd) to list the attributes of a diskgroup, including physical and logical sector sizes.
[oracle@z-oracle ~]$ asmcmd lsattr -G DATA_4K -l Name Value access_control.enabled FALSE access_control.umask 066 appliance._partnering_type NULL au_size 4194304 cell.smart_scan_capable FALSE cell.sparse_dg allnonsparse compatible.asm 12.2.0.0.0 compatible.rdbms 10.1.0.0.0 content.check FALSE content.type data disk_repair_time 12.0h failgroup_repair_time 24.0h idp.boundary auto idp.type dynamic logical_sector_size 512 phys_meta_replicated true preferred_read.enabled FALSE scrub_async_limit 1 scrub_metadata.enabled TRUE sector_size 512 thin_provisioned FALSE
Summary
In this post I have shared how we can disable the Oracle ASM validation sector size checks, and how to change the physical and logical section for education and testing purposes.
Leave a Reply