Skip to content

How to Reclaim Disks From ASM On Enterprise Linux 5

  • by
As data growing in an enterprise, adding disks for extending overall space of ASM is a more logical practice than dropping disks. But sometimes, you will need to reclaim disks for different purposes.

Dropping disks from an ASM diskgroup can be done while the database is running. But for a safer and faster operation, you may decide to shutdown the database first.
[oracle@primary01 ~]$ srvctl status database -d compdb
Instance primdb1 is running on node primary01
Instance primdb2 is running on node primary02
[oracle@primary01 ~]$ srvctl stop database -d compdb
[oracle@primary01 ~]$ srvctl status database -d compdb
Instance primdb1 is not running on node primary01
Instance primdb2 is not running on node primary02

List all disks by asmcmd. There are 8 disks online.
[oracle@primary01 ~]$ asmcmd
ASMCMD> lsdsk -k
Total_MB  Free_MB  OS_MB  Name    Failgroup  Library                                               Label   UDID  Product  Redund   Path
   19519    18920  19519  DISK01  DISK01     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK01                 UNKNOWN  ORCL:DISK01
   19519    18922  19519  DISK02  DISK02     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK02                 UNKNOWN  ORCL:DISK02
   19519    18915  19519  DISK03  DISK03     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK03                 UNKNOWN  ORCL:DISK03
   19519    18956  19519  DISK04  DISK04     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK04                 UNKNOWN  ORCL:DISK04
   19519    18955  19519  DISK05  DISK05     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK05                 UNKNOWN  ORCL:DISK05
   19519    18954  19519  DISK06  DISK06     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK06                 UNKNOWN  ORCL:DISK06
   19519    18950  19519  DISK07  DISK07     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK07                 UNKNOWN  ORCL:DISK07
   19519    18948  19519  DISK08  DISK08     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK08                 UNKNOWN  ORCL:DISK08

List all disks by querying dynamic views.
[oracle@primary01 ~]$ sqlplus / as sysasm
...
SQL> column diskgroup format a10;
SQL> column disk_name format a10;
SQL> column failgroup format a10;
SQL> select dg.name diskgroup, dk.name disk_name, dk.failgroup, dk.mount_status, dk.mode_status from v$asm_disk dk, v$asm_diskgroup dg where dk.group_number = dg.group_number;

DISKGROUP  DISK_NAME  FAILGROUP  MOUNT_S MODE_ST
---------- ---------- ---------- ------- -------
DATA       DISK01     DISK01     CACHED  ONLINE
DATA       DISK02     DISK02     CACHED  ONLINE
DATA       DISK03     DISK03     CACHED  ONLINE
DATA       DISK04     DISK04     CACHED  ONLINE
DATA       DISK05     DISK05     CACHED  ONLINE
DATA       DISK06     DISK06     CACHED  ONLINE
DATA       DISK07     DISK07     CACHED  ONLINE
DATA       DISK08     DISK08     CACHED  ONLINE

8 rows selected.

OK, let's drop 4 disks.
SQL> alter diskgroup data drop disk disk08, disk07, disk06, disk05 rebalance power 5 wait;

Diskgroup altered.

In the above, we manually rebalance and redistribute data among current diskgroup with degree power 5 which is rather an acceptable and neutral choice than the lowest degree 0 and highest degree 11. With "power 11", it could take a considerable time to complete.

Alternatively, you can run the statement without waiting.
SQL> alter diskgroup data drop disk disk08, disk07, disk06, disk05 rebalance power 5 nowait;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- --------------------------------------------
           1 REBAL RUN           5          5        295       2548        604           3

Let's check the disk group after dropping.
SQL> select dg.name diskgroup, dk.name disk_name, dk.failgroup, dk.mount_status, dk.mode_status from v$asm_disk dk, v$asm_diskgroup dg where dk.group_number = dg.group_number;

DISKGROUP  DISK_NAME  FAILGROUP  MOUNT_S MODE_ST
---------- ---------- ---------- ------- -------
DATA       DISK01     DISK01     CACHED  ONLINE
DATA       DISK02     DISK02     CACHED  ONLINE
DATA       DISK03     DISK03     CACHED  ONLINE
DATA       DISK04     DISK04     CACHED  ONLINE

SQL> column path format a12;
SQL> select name disk_name, path, mount_status, mode_status, state from v$asm_disk;

DISK_NAME  PATH         MOUNT_S MODE_ST STATE
---------- ------------ ------- ------- --------
           ORCL:DISK05  CLOSED  ONLINE  NORMAL
           ORCL:DISK06  CLOSED  ONLINE  NORMAL
           ORCL:DISK07  CLOSED  ONLINE  NORMAL
           ORCL:DISK08  CLOSED  ONLINE  NORMAL
DISK01     ORCL:DISK01  CACHED  ONLINE  NORMAL
DISK02     ORCL:DISK02  CACHED  ONLINE  NORMAL
DISK03     ORCL:DISK03  CACHED  ONLINE  NORMAL
DISK04     ORCL:DISK04  CACHED  ONLINE  NORMAL

8 rows selected.

Check the disks by asmcmd.
[oracle@primary01 ~]$ asmcmd
...
ASMCMD> lsdsk -k
Total_MB  Free_MB  OS_MB  Name    Failgroup  Library                                               Label   UDID  Product  Redund   Path
   19519    18357  19519  DISK01  DISK01     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK01                 UNKNOWN  ORCL:DISK01
   19519    18352  19519  DISK02  DISK02     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK02                 UNKNOWN  ORCL:DISK02
   19519    18355  19519  DISK03  DISK03     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK03                 UNKNOWN  ORCL:DISK03
   19519    18388  19519  DISK04  DISK04     ASM Library - Generic Linux, version 2.0.4 (KABI_V2)  DISK04                 UNKNOWN  ORCL:DISK04

The dropped disks becomes candidates.
ASMCMD> lsdsk --candidate
Path
ORCL:DISK05
ORCL:DISK06
ORCL:DISK07
ORCL:DISK08

For Linux, we have not remove these disks from the list of ASM entirely so far. So, lets' continue if you are running on Linux.

Remove these disks from ASM and return to OS. But first, let's switch user to root. Only root can execute oracleasm without problems.
[oracle@primary01 ~]$ su -
Password:
[root@primary01 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04
DISK05
DISK06
DISK07
DISK08
[root@primary01 ~]# oracleasm deletedisk -v DISK05
Clearing disk header: done
Dropping disk: done
[root@primary01 ~]# oracleasm deletedisk -v DISK06
Clearing disk header: done
Dropping disk: done
[root@primary01 ~]# oracleasm deletedisk -v DISK07
Clearing disk header: done
Dropping disk: done
[root@primary01 ~]# oracleasm deletedisk -v DISK08
Clearing disk header: done
Dropping disk: done
[root@primary01 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04

ASMCMD shows those disks are freed from ASM.
ASMCMD> lsdsk
Path
ORCL:DISK01
ORCL:DISK02
ORCL:DISK03
ORCL:DISK04
ASMCMD> lsdsk --candidate
Path

Check the result by querying v$asm_disk. SQL> select name disk_name, path, mount_status, mode_status, state from v$asm_disk;

DISK_NAME  PATH         MOUNT_S MODE_ST STATE
---------- ------------ ------- ------- --------
DISK01     ORCL:DISK01  CACHED  ONLINE  NORMAL
DISK02     ORCL:DISK02  CACHED  ONLINE  NORMAL
DISK03     ORCL:DISK03  CACHED  ONLINE  NORMAL
DISK04     ORCL:DISK04  CACHED  ONLINE  NORMAL

You can reuse these disks now.

Leave a Reply

Your email address will not be published.