Saturday, August 1, 2015

ASM Diks Resizing After Underlying Storage Disk Expansion

There are two ways to add more space to an ASM diskgroup. One is to add more disks to the group and second is to expand the disk already in the group. This post shows the step for the latter case. The current setup contains two ASM diskgroup each with exactly one disk.
GROUP_NAME DISK_NAME       GROUP_SIZE_MB DISK_SIZE_MB PATH
---------- --------------- ------------- ------------ ----------
DATA       DATA_0000               10236        10236 /dev/sdb1
FLASH      FLASH_0000              10236        10236 /dev/sdc1
Size of the disk added to the flash diskgroup is roughly 10GB and this will be expanded to 12GB. ASM is used for a standalone database (11.2.0.4) created on VirtulBox VM. The expansion of the underlying storage disk is achieved using VBoxManagment. If this is a SAN LUN then vendor provided tools/commands could be used to achieve the same.
# VBoxManage modifyhd rhel5flash.vdi --resize 12288
Shutdown the GI stack on the server before the disk expansion. Once the expansion is complete GI stack could be started but the additional space won't be visible to Oracle and trying to resize the ASM disk would fail.
SQL> alter diskgroup flash resize disk FLASH_0000 size 12000m;
alter diskgroup flash resize disk FLASH_0000 size 12000m
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15057: specified size of 12000 MB is larger than actual size of 10236 MB
This is because even though the disk was expanded the storage disk partition created for the ASM disk is still at the original size.
fdisk -l /dev/sdc

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1305    10482381   83  Linux


Only way to resize the partition is to re-create. This would entail deleting the current partition as such stop the GI stack before partition recreation.
$ crsctl stop has

# fdisk /dev/sdc

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Once the partition is recreated verify size has increased
# fdisk -l /dev/sdc

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1566    12578863+  83  Linux
Start the GI stack and resize ASM disk
crsctl start has
CRS-4123: Oracle High Availability Services has been started.

SQL> alter diskgroup flash resize disk FLASH_0000 size 12000m;
If multiple disks are resized then it is possible to add the re-balance option to the alter diskgroup. ASM alert log the resize operation
SQL> alter diskgroup flash resize disk FLASH_0000 size 12000m
NOTE: requesting all-instance membership refresh for group=2
NOTE: requesting all-instance disk validation for group=2
Thu Jul 30 15:42:42 2015
NOTE: disk validation pending for group 2/0x2c5db20f (FLASH)
SUCCESS: validated disks for 2/0x2c5db20f (FLASH)
NOTE: increased size in header on grp 2 disk FLASH_0000
NOTE: membership refresh pending for group 2/0x2c5db20f (FLASH)
Thu Jul 30 15:42:49 2015
GMON querying group 2 at 9 for pid 13, osid 5803
SUCCESS: refreshed membership for 2/0x2c5db20f (FLASH)
NOTE: starting rebalance of group 2/0x2c5db20f (FLASH) at power 1
SUCCESS: alter diskgroup flash resize disk FLASH_0000 size 12000m
Starting background process ARB0
Thu Jul 30 15:42:49 2015
ARB0 started with pid=28, OS id=6019
NOTE: assigning ARB0 to group 2/0x2c5db20f (FLASH) with 1 parallel I/O
cellip.ora not found.
NOTE: stopping process ARB0
SUCCESS: rebalance completed for group 2/0x2c5db20f (FLASH)
NOTE: Attempting voting file refresh on diskgroup FLASH
Thu Jul 30 15:42:52 2015
NOTE: requesting all-instance membership refresh for group=2
Thu Jul 30 15:42:55 2015
NOTE: membership refresh pending for group 2/0x2c5db20f (FLASH)
GMON querying group 2 at 10 for pid 13, osid 5803
SUCCESS: refreshed membership for 2/0x2c5db20f (FLASH)
NOTE: Attempting voting file refresh on diskgroup FLASH
Query the diskgroup and disk for the increase in size.
GROUP_NAME DISK_NAME       GROUP_SIZE_MB DISK_SIZE_MB PATH
---------- --------------- ------------- ------------ ----------
DATA       DATA_0000               10236        10236 /dev/sdb1
FLASH      FLASH_0000              12000        10236 /dev/sdc1
This concludes resizing of ASM disk after underlying storage expansion.

Useful Metalink Notes
How To Resize an ASM Disk? [ID 373426.1]
Master Note for Automatic Storage Management (ASM) [ID 1187723.1]
Resize of ASM Disk Fails with ORA-600 [KFDATSHRINK_NOTFREE] [ID 2015973.1]
Versions 11.2.0.4 and later: When a LUN is expanded, unable to resize ASM disks online [ID 2000490.1]
Master Note For Automatic Storage Management (ASM) For Operating System (OS) Administrators [ID 1345562.1]