Keep Disks in your Diskgroup the same size
April 10, 2008In my production instances, I have only ever used ASM with external redundancy. Hey, I’m paying expensive fees for fancy hardware RAID, I might as well use it. I therefore tend to present to ASM a LUN which is normally a RAID 10 stripe set. As far as ASM is concerned this is one large disk and it does not have to worry about failure groups.
Well, that is the ideal, but as we know we don’t live in a perfect world. On one of the production instances, due to using “hand me down” hardware, I have created 2 LUNS, and these are of differing sizes. Everything was running along happily until, one of the LUNS ran out of space.
I had thought ASM was meant to distribute extents based on the size of the disks in the diskgroup, so for example, if your diskgroup was made up of 2 disks and one was say 60GB and one was 120GB the 120GB would contain twice as many extents (Allocation Units) as the 60GB disk. This would ensure that one disk in the diskgroup was never filled up while the other one still had plenty of space. Well, it seems that this does not necessarily work perfectly in practice.
So I have a diskgroup lets, call it DATA4 and it is made up of two disks VOL4 and VOL5 and when you look at V$ASM_DISKGROUP this diskgroup has lots of lovely free space:
SQL> select group_number, name, total_mb, free_mb from V$ASM_DISKGROUP; GROUP_NUMBER NAME TOTAL_MB FREE_MB ------------ ------------------ ---------- ---------- 4 DATA4 220391 24501
So If you just looked at that view you would be hard pushed to explain why you could not allocate space in your diskgroup. However if you diskgroup is made up of multiple disks take a look at the following view:
SQL> select group_number, name, TOTAL_MB, FREE_MB from V$asm_disk_stat; GROUP_NUMBER NAME TOTAL_MB FREE_MB ------------ ------------------------------ ---------- ---------- 4 VOL4 124660 24501 4 VOL5 95731 0
Oh great! All the available space in the diskgroup is on one of the disks in the diskgroup. ASM is not clever enough to just then allocate new extents to this disk in the diskgroup, it will just keep on doing it’s effective round robin distribution of extents, which means you will get an ORA-15041 error saying the diskgroup space is exhausted. And you’ll be convinced that it ain’t so if you just look at V$ASM_DISKGROUP.
Thankfully, there is help at hand to fix this in the rebalance process. I had thought a rebalance was only required when the storage had physically changed, i.e. adding a new disk, but a rebalance basically evened out where the data was stored:
SQL> alter diskgroup DATA4 rebalance;
You can set a variable level of speed to the rebalance using the power syntax. After the rebalance completed and it took 41 minutes at power 1. I saw the following in V$ASM_DISK_STAT:
SQL> select group_number, name, TOTAL_MB, FREE_MB from V$asm_disk_stat; GROUP_NUMBER NAME TOTAL_MB FREE_MB ------------ ------------------------------ ---------- ---------- 4 VOL4 124660 13859 4 VOL5 95731 10642
Bingo! I can now allocate new extents in my diskgroup and I have not increased the storage available by 1 byte.
Definitely, it will save you pain if you keep all disks in your diskgroup the same size.
Posted by jarneil