Dropping a disk in an ASM Disk Group
One of the big selling points of ASM is the ability to reconfigure the storage online. Previously I’ve blogged about expanding a disk in a disk group. Another useful feature of ASM is to use it to migrate from one set of disks in a disk group to another, or indeed from one storage array to another.
This is basically achievable because ASM distributes data across all disks in a disk group evenly, and assuming you have enough space, you can happily drop disks in a disk group and ASM will seamlessly migrate the data to the existing disks in the disk group.
SQL> select group_number, name, TOTAL_MB, FREE_MB
from V$asm_disk_stat;
GROUP_NUMBER NAME TOTAL_MB FREE_MB ------------ ---------------- ---------- ---------- 1 VOL1 61439 61187 2 VOL2 61439 61164 3 VOL3 61439 61164 4 VOL4 409594 310962 4 VOL5 153597 95240
So, we see here that VOL4 and VOL5 are two disks (luns) in disk group 4. Previously I had expanded VOL4 and this now has enough capacity to encompass all the data resident on this disk group. I am now safe to drop VOL5 and this is an online operation:
SQL> alter diskgroup DATA4 drop disk VOL5;
Diskgroup altered.
This alter diskgroup command essentially shuffles extents from the disk you are removing and distributes them to the remaining disks in your disk group. While the operation is continuing you can check V$ASM_OPERATION for the progress you are making:
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ------------ ----- ---- ----- ----- ------ ------- ---------- ---------- 4 REBAL RUN 1 1 100 42234 1007 41
Most of the columns here are self explanatory, however the SOFAR column tells you the number of Allocation Units (au) that have been moved, the EST_WORK and EST_RATE are also in au and au/minute.
Once the rebalance has moved all the Allocation Units the disk is removed from the disk group:
SQL> select group_number, name, TOTAL_MB, FREE_MB
from V$asm_disk_stat;
GROUP_NUMBER NAME TOTAL_MB FREE_MB ------------ ---------------- ---------- ---------- 1 VOL1 61439 61187 2 VOL2 61439 61164 3 VOL3 61439 61164 4 VOL4 409594 252006
Dropping a disk in a disk group seemed to work as advertised, the real benefit of course, is instead of it being just a disk you were dropping but that it was a lun representing a whole storage array, then this has real potential for allowing you to upgrade storage or even migrate to a different storage platform entirely.