Storage AFD:UNMAP Protocol With ASM Disk

In Oracle storage environments using ASM (Automatic Storage Management) with AFD (ASM Filter Driver), the UNMAP protocol plays a key role in space reclamation—especially when you’re using thin-provisioned storage such as SSDs or SAN systems that support SCSI UNMAP or NVMe deallocation.

What is the UNMAP Protocol?

The UNMAP protocol is a SCSI command (or equivalent NVMe command) that enables a host (like a Linux server running Oracle) to inform the storage array that certain blocks are no longer in use and can be reclaimed or deallocated.

How UNMAP Works with ASM + AFD

In an Oracle ASM environment using AFD-managed disks, when datafiles, ASM files, or database segments are deleted or moved, Oracle can issue UNMAP commands to the underlying storage, if supported and enabled.

Benefits of Using UNMAP in ASM with AFD

  • Storage Efficiency: Frees up unused blocks on thin-provisioned disks.
  • Performance: Maintains high performance by keeping the storage clean.
  • Cost Saving: Reduces actual storage consumption on shared arrays.

Caution

  • Improper UNMAP use on non-thin or unsupported devices can cause performance issues.
  • Always test on non-prod systems before enabling wide-scale.

Enable the ASM ‘thin_provisioned’ attribute

To check & change the ASMFD thin_provisioned status, use the SQL code below:

set linesize 250
 
column diskgroup heading 'Diskgroup' format a15
column name heading 'Attribute Name' format a25
column value heading 'Value' format a15
column read_only heading 'Read Only' format a15
 
SELECT
  SUBSTR(dg.name,1,12) AS diskgroup, SUBSTR(a.name,1,24) AS name,
  SUBSTR(a.value,1,24) AS value, read_only 
FROM
  V$ASM_DISKGROUP dg, 
  V$ASM_ATTRIBUTE a 
WHERE
  dg.group_number = a.group_number AND
  a.name NOT LIKE '%template%' AND
  a.name LIKE '%thin%'
/ 
exit

We can change the ‘thin_provisioned’ attribute using ASMCA or using ‘alter disk group <DISK_GROUP> set attribute ‘thin_provisioned’=’TRUE’;’

SQL> alter diskgroup AFDATA set attribute'thin_provisioned'='TRUE';
Diskgroup altered.

We can also use the asmcmd lsattr command:

[oracle@z-oracle ~]$ asmcmd lsattr -G AFDATA -l | grep thin
thin_provisioned            TRUE

Storage vendor

Storage vendor products that support thin provisioning have the capability to reuse the discarded storage space for a more efficient overall physical storage utilization. Given such support from a storage vendor, when the COMPACT phase of a rebalance operation has completed, Oracle ASM informs the storage which space is no longer used and can be repurposed. If a rebalance is not running, you can issue a rebalance with the ALTER DISKGROUP … REBALANCE SQL statement.

Oracle ASM rebalance compact Phase

From Oracle MOS Note: What is ASM rebalance compact Phase and how it can be disabled (Doc ID 1902001.1)

The compact phase is part of rebalance operation, it moves the data as close as possible to the outer tracks of the disks (the lower numbered offsets).

In the disk world we try to place data on the outer tracks as these have lower seek times, performing faster than inner tracks because the outer tracks have more data packed in and more sectors per track.

Summary

If you want to learn more about the installation, configuration, migration and management of ASM Filter Driver you consult the Administering Oracle ASM Filter Driver section within the Oracle Database 19c Administrator’s Guide.

Leave a comment

About Me

I’m Dhiraj Kumar, an Oracle RAC Database With over 15 years of experience, I’m passionate about building high-performance, scalable database solutions that support critical business operations.

📘 Check out my latest articles and insights on Medium (@dhirajengr) .