理解ASM中 REQUIRED_MIRROR_FREE_MB和USABLE_FILE_MB的含义

理解ASM中 REQUIRED_MIRROR_FREE_MB和USABLE_FILE_MB的含义

A recurring question in my classes is how Oracle Automatic Storage Management (ASM) calculates the REQUIRED_MIRROR_FREE_MB and USABLE_FILE_MB disk group values. As usual the answer is: It depends! ;-)

在我的课上一个经常被问到的问题是ASM如何计算磁盘组REQUIRED_MIRROR_FREE_MB和USABLE_FILE_MB的值,这个问题的答案跟很多复杂问题的答案一样:要看情况。

In short: the REQUIRED_MIRROR_FREE_MB value in V$ASM_DISKGROUP indicates how much free space is required in an ASM disk group to restore redundancy after the failure of an ASM disk or ASM failure group. The USABLE_FILE_MB value indicates how much space is available in an ASM disk group considering the redundancy level of the disk group. The question is: How does ASM calculate these values?

简单来说,视图V$ASM_DISKGROUP中的REQUIRED_MIRROR_FREE_MB值代表了如果ASM磁盘或ASM磁盘组出现了故障,要重新满足冗余度的定义,要求有多少的空闲空间。USABLE_FILE_MB的值代表了在满足冗余度之后,还有多少的剩余空间可以用。问题是:ASM怎么计算出这些值的?

The answer can be found by creating ASM disk groups in different configurations and take a look at the REQUIRED_MIRROR_FREE_MB and USABLE_FILE_MB values in V$ASM_DISKGROUP. All we need are a bunch of small disks.

问题的答案可以通过创建一些不同配置的磁盘组,然后观察视图V$ASM_DISKGROUP中的REQUIRED_MIRROR_FREE_MB 和 USABLE_FILE_MB。为了找到答案,我们仅仅只需要一些磁盘而已。

ASM> select label,os_mb from v$asm_disk
  2  where label like 'SAN%' order by label;

LABEL                                OS_MB
------------------------------- ----------
SAN01                                  255
SAN02                                  255
SAN03                                  255
SAN04                                  255
SAN05                                  255
SAN06                                  255

REQUIRED_MIRROR_FREE_MB and USABLE_FILE_MB in external redundancy disk groups

Let’s get started by creating an external redundancy disk group on top of the above 6 disks:

我们先从创建一个外部冗余的磁盘组开始,这里使用到了我们上面列出的6块盘,每个盘的大小是255MB:

ASM> create diskgroup demo external redundancy
  2  disk 'ORCL:san01'
  3  disk 'ORCL:san02'
  4  disk 'ORCL:san03'
  5  disk 'ORCL:san04'
  6  disk 'ORCL:san05'
  7  disk 'ORCL:san06'
  8  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

Now we can explore this disk group by querying several columns from V$ASM_DISKGROUP:

我们查询视图V$ASM_DISKGROUP中的几个列来获得磁盘组的相关信息:

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     EXTERN       1530    1468        0   1468

The above output shows that this disk group size is 1530MB (TOTAL_MB ) of which 1468MB (FREE_MB)is free space. Because this is an external redundancy disk group, all free space is available for storing files as indicated by the USABLE_FILE_MB column. The REQUIRED_MIRROR_FREE_MB column is zero because ASM does not mirror user data in external redundancy disk groups.

以上输出显示了磁盘组的总大小为1530MB(TOTAL_MB),其中1468MB(FREE_MB)是空闲的空间,由于这是一个外部冗余的磁盘组,因此所有的空闲空间都可以用来存放文件,USABLE_FILE_MB列的值也显示了这一点,REQUIRED_MIRROR_FREE_MB的值为0
Note: The “missing” 62MB is used for storing ASM metadata.

REQUIRED_MIRROR_FREE_MB and USABLE_FILE_MB in normal redundancy disk groups

Next we create a normal redundancy disk group with six failure groups of one disk each.

接下来我们创建一个normal冗余的磁盘组,磁盘组共有6块磁盘,每一个盘是一个独立的failgroup。

ASM> create diskgroup demo normal redundancy
  2  failgroup FG1 disk
  3  'ORCL:san01'
  4  failgroup FG2 disk
  5  'ORCL:san02'
  6  failgroup FG3 disk
  7  'ORCL:san03'
  8  failgroup FG4 disk
  9  'ORCL:san04'
 10  failgroup FG5 disk
 11  'ORCL:san05'
 12  failgroup FG6 disk
 13  'ORCL:san06'
 14  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

ASM uses failure groups to provide redundancy inside disk groups. Data stored in one failure group is also stored in another failure group to protect it against failures. In a normal redundancy disk group the loss of one failure group can be tolerated without affecting data availability. ASM will restore redundancy by re-creating the lost data in another failure group. But this requires that a certain amount of disk group space is available within the same disk group to store this data. Because of this, it is useful to know how big a single failure group actually is.

ASM在磁盘组内使用failgroup来提供数据的镜像和冗余,数据被存储在一个failgroup的同时,会自另外的failgroup中存储相同的数据副本,以此来保障数据的安全,在一个normal冗余的磁盘组中,一个failgroup出现故障并不会影响整个磁盘组的可用性,ASM还可以根据镜像数据让磁盘组重新达到normal冗余的要求,但是为了能做到这一点,需要磁盘组有足够的剩余空间,因此一个failgroup实际有多大就显得非常的重要。

ASM> select failgroup,sum(total_mb) from v$asm_disk
  2  where label like 'SAN%' group by failgroup order by failgroup;

FAILGROUP                      SUM(TOTAL_MB)
------------------------------ -------------
FG1                                      255
FG2                                      255
FG3                                      255
FG4                                      255
FG5                                      255
FG6                                      255

The above output tells us that the size of a single failure group is 255MB. Let’s see how this influences the free space requirements and how it affects usable file space:

上面输出显示每一个failgroup的的总大小都是255MB,我们看下它如何影响剩余空间的要求以及它如何影响可用的文件空间。

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530    1365      255    555

The above output indicates that there should be 255MB free space available in order to allow ASM to restore redundancy after a failure. The value is 255 because it is the size of one failure group. In case failure groups are not equally sized, ASM automatically selects the biggest failure group for this calculation.

上面输出显示了,为了能够在磁盘组的一个failgroup出现故障后能够重新满足磁盘组冗余度的要求,需要有255MB的剩余空间(REQUIRED_MIRROR_FREE_MB)。255这个数值是磁盘组的一个failgroup的大小,如果磁盘组里的failgroup的大小不等,那么ASM会自动选择具有最大空间的failgroup。

The above output also indicates that we can use 555MB for storing files. This value is calculated as follows:

上面的输出也显示了我们还可以使用555MB的空间来存放文件,这个值是按照如下公式计算出来的:

ASM> select trunc((free_mb - REQUIRED\_MIRROR\_FREE\_MB) / 2) as useable
  2  from v$asm_diskgroup where name='DEMO';

   USEABLE
----------
       555

In plain English: The amount of usable file space is equal to the amount of free disk space subtracted by the amount of disk space that is required to restore redundancy after a failure divided by the redundancy level of the disk group which is two in this case.

上面的公式翻译过来就是:总的可用空间等于总的剩余空间减去REQUIRED_MIRROR_FREE_MB后的值再除以磁盘组的冗余度,这里normal冗余也就是要除以2。REQUIRED_MIRROR_FREE_MB的含义我们上面已经提到过:为了能够在磁盘组的一个failgroup出现故障后能够重新满足磁盘组冗余度的要求而需要的空间。

Thus based on the amount of free space, the amount of required free space and the redundancy level ASM calculates the amount of space available for storing files. If the amount of free space changes, because a file gets created, resized or deleted, this value will also change. This can be demonstrated by creating a data file in this disk group.

由于可用空间的公式中的free_mb的值是动态变化的,例如新增了文件或文件做了resize等操作都会影响磁盘组的剩余空间,因此磁盘组的可用空间也是动态变化的,这一点可用通过一个简单的例子加以说明:

SQL> create tablespace foo datafile '+DEMO' size 200m;

Tablespace created.

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530     939      255    342

Because we created a 200MB data file the amount of usable file space is reduced as shown above. The reduction is slightly more than the file size because ASM allocated a bit more space for its metadata. Let’s add another file to our tablespace:

由于我们往磁盘组中新增加了一个200MB的数据文件,导致了磁盘组的可用空间减少了,从555MB减少到了342MB。

SQL> alter tablespace foo add datafile '+DEMO' size 200m;

Tablespace altered.

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530     534      255    139

As expected the amount of usable file space is reduced by slightly more than the actual file size. Can we create another 200MB data file?

在又新增了一个数据文件后,如预期,可用的空间又进一步减少了,减少的空间略微的大于实际新增的文件size,现在可用空间只剩下139MB了,我们再新增一个200MB的数据文件会怎么样?

SQL> alter tablespace foo add datafile '+DEMO' size 200m;

Tablespace altered.

We could indeed create another 200MB data file despite the fact that ASM indicated that there was only 139MB usable file space available. It is important to note that ASM does not enforce the amount of free space indicated by REQUIRED_MIRROR_FREE_MB. Let’s take a look at the value of USABLE_FILE_MB now:

尽管ASM显示了仅仅只有139MB的可用空间,但是我们确实又成功的创建了一个大小为200MB的数据文件,因此这里需要强调,ASM并不会强制预留出REQUIRED_MIRROR_FREE_MB所指示的空间。

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530     129      255    -63

The value has turned negative! This means that if we encounter a failure ASM will be unable to restore redundancy because there is not enough space to do so. It is very important that USABLE_FILE_MB is monitored! If it becomes negative for a particular disk group, you should either increase the size of the disk group or free up some space in it. For now we will just drop the tablespace ;-)

USABLE_FILE_MB的值已经变为了负数,这意味着如果我们遭遇了故障ASM有可能会没有足够的剩余空间来重新满足冗余度的要求,因此监控USABLE_FILE_MB的值非常的重要,如果某个磁盘组的USABLE_FILE_MB值变为了负数,你应该增加磁盘组的空间或者释放出一些空间出来。现在我们删除掉这个表空间看看:

SQL> drop tablespace foo;

Tablespace dropped.

Now let’s create another normal redundancy disk group, but this time with only three failure groups each with two disks instead of six failure groups each with only one disk:

现在我们创建另一个normal冗余的磁盘组,这次仅仅只创建3个failgroup,每一个failgroup包含了2个磁盘(之前创建的磁盘组包含了6个failgroup,每一个磁盘是一个failgroup):

ASM> create diskgroup demo normal redundancy
  2  failgroup FG1 disk
  3  'ORCL:san01',
  4  'ORCL:san02'
  5  failgroup FG2 disk
  6  'ORCL:san03',
  7  'ORCL:san04'
  8  failgroup FG3 disk
  9  'ORCL:san05',
 10  'ORCL:san06'
 11  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

Now that the disk group is created we again take a look at the sizes of its failure groups:

在磁盘组成功创建后,我们再来看下failgroup的大小:

ASM> select failgroup,sum(total_mb) from v$asm_disk
  2  where label like 'SAN%' group by failgroup order by failgroup;

FAILGROUP                      SUM(TOTAL_MB)
------------------------------ -------------
FG1                                      510
FG2                                      510
FG3                                      510

All three failure groups are equally sized at 510MB. Let’s see how this is reflected in the space administration columns in V$ASM_DISKGROUP:

三个failgroup的大小都是510MB,我们再来看下视图V$ASM_DISKGROUP中相关列的情况:

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530    1365      510    427

As expected REQUIRED_MIRROR_FREE_MB is now 510 which is of course equal to the size of the biggest failure group. This results in 427MB of usable file space. As shown before this value is calculated as follows:

跟预期一样,REQUIRED_MIRROR_FREE_MB的值为510,等于磁盘组中最大的failgroup的大小,USABLE_FILE_MB的值为427,就像之前已经提到过的,它的值根据以下公式计算而来:

ASM> select trunc((free_mb - REQUIRED\_MIRROR\_FREE\_MB) / 2) as useable
  2  from v$asm_diskgroup where name='DEMO';

   USEABLE
----------
       427

Next we create yet another normal redundancy disk group, but this time with only two failure groups each with three disks instead of three failure groups each with two disks:

接下来,我们继续创建一个normal冗余的磁盘组,这一次只有2个failgroup,每个failgroup中有3个磁盘:

ASM> create diskgroup demo normal redundancy
  2  failgroup FG1 disk
  3  'ORCL:san01',
  4  'ORCL:san02',
  5  'ORCL:san03'
  6  failgroup FG2 disk
  7  'ORCL:san04',
  8  'ORCL:san05',
  9  'ORCL:san06'
 10  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

Again we determine the size of all failure groups:

同样,我们看下磁盘组中每一个failgroup的大小:

ASM> select failgroup,sum(total_mb) from v$asm_disk
  2  where label like 'SAN%' group by failgroup order by failgroup;

FAILGROUP                      SUM(TOTAL_MB)
------------------------------ -------------
FG1                                      765
FG2                                      765

Both failure groups are equally sized at 765MB. What will the impact be on the space administration?

两个failgroup的大小都等于765MB,同样查看视图v$asm_diskgroup相关字段的值:

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     NORMAL       1530    1416      255    580

Hmmm, REQUIRED_MIRROR_FREE_MB is only 255 (the size of one disk) instead of 765 (the size of one failure group) as one might expect. Apparently ASM only anticipates on the failure of a single disk and no longer anticipates on the failure of a complete failure group.

这次的结果有点出乎意料,REQUIRED_MIRROR_FREE_MB的值仅仅只有255MB,而不是765MB(failgroup的大小),显然,ASM只一次只是给了一个磁盘的大小作为REQUIRED_MIRROR_FREE_MB的值,而不是整个failgroup的大小。

When you think about this it actually makes sense! As stated at the beginning of this posting, ASM performs mirroring by storing the same data in different failure groups. A normal redundancy disk group requires at least two failure groups and a high redundancy disk group requires at least three failure groups. How can ASM restore redundancy in a normal redundancy disk group when there is only one failure group left? It can’t! Therefore ASM anticipates only on the loss of a single disk.

道理在哪里?就像文章开头提出的,ASM会在不同的failgroup中存储镜像数据,一个normal冗余的磁盘组要求至少有2个failgroup,一个high冗余的磁盘组要求至少3个failgroup,如果具有2个failgroup的normal冗余磁盘组,其中一个failgroup发生了故障,那么这个磁盘组如何重新满足冗余度的要求?不能!因此这种情况下,ASM仅仅给出了一个磁盘的大小作为REQUIRED_MIRROR_FREE_MB的值。

For completeness, this is how ASM calculated the USABLE_FILE_MB value of 580:

同理,我们可以根据公式计算出USABLE_FILE_MB的值:

ASM> select trunc((free_mb - REQUIRED\_MIRROR\_FREE\_MB) / 2) as useable
  2  from v$asm_diskgroup where name='DEMO';

   USEABLE
----------
       580

REQUIRED_MIRROR_FREE_MB and USABLE_FILE_MB in high redundancy disk groups

Now that we covered external and normal redundancy disk groups, we will take a look at high redundancy disk groups. So, let’s get started by creating a high redundancy disk group with six failure groups of one disk each and determine the size of its failure groups:

我们已经讨论了external和normal冗余的磁盘组,我们接下来看high冗余的磁盘组的情况。首先,我们需要创建一high冗余度的磁盘组,磁盘组中的盘还是我们上面使用的6块磁盘,每一个盘是一个单独的failgroup:

ASM> create diskgroup demo high redundancy
  2  failgroup FG1 disk
  3  'ORCL:san01'
  4  failgroup FG2 disk
  5  'ORCL:san02'
  6  failgroup FG3 disk
  7  'ORCL:san03'
  8  failgroup FG4 disk
  9  'ORCL:san04'
 10  failgroup FG5 disk
 11  'ORCL:san05'
 12  failgroup FG6 disk
 13  'ORCL:san06'
 14  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

ASM> select failgroup,sum(total_mb) from v$asm_disk
  2  where label like 'SAN%' group by failgroup order by failgroup;

FAILGROUP                      SUM(TOTAL_MB)
------------------------------ -------------
FG1                                      255
FG2                                      255
FG3                                      255
FG4                                      255
FG5                                      255
FG6                                      255

As expected all failure groups are equally sized at 255MB. Could there be a difference between the required free and usable disk space for a high redundancy disk group and a normal redundancy disk group with the same number of disks and failure groups? Let’s have a look:

如预期,所有的failgroup的大小都是255MB,REQUIRED_MIRROR_FREE_MB和USABLE_FILE_MB的值的计算方法在normal冗余和high冗余下是不是一样的呢?我们来看一下:

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     HIGH         1530    1365      510    285

REQUIRED_MIRROR_FREE_MB is 510, which is equal to the sum of the size of two failure groups (or the sum of the sizes of the two biggest failure groups if they are not equally sized). This is because a high redundancy disk group can tolerate the loss of two failure groups without affecting data availability.

REQUIRED_MIRROR_FREE_MB的值为510MB,等于2个failgroup的大小(如果磁盘组中failgroup的大小不一样,会取两个最大的failgroup大小),这是因为一个high冗余的磁盘组需要能够容忍丢失2个failgroup而不影响数据的可用性

USABLE_FILE_MB is 285 and is calculated as follows:

USABLE_FILE_MB的值为285,按照如下公式计算而来:

ASM> select trunc((free_mb - REQUIRED\_MIRROR\_FREE\_MB) / 3) as useable
  2  from v$asm_diskgroup where name='DEMO';

   USEABLE
----------
       285

Finally we create another high redundancy disk group but this time with three failure groups each with two disks instead of six failure groups of one disk each, followed by querying the failure group sizes:

最后我们创建另一个high冗余的磁盘组,一共3个磁盘组,每2个磁盘一个failgroup:

ASM> create diskgroup demo high redundancy
  2  failgroup FG1 disk
  3  'ORCL:san01',
  4  'ORCL:san02'
  5  failgroup FG2 disk
  6  'ORCL:san03',
  7  'ORCL:san04'
  8  failgroup FG3 disk
  9  'ORCL:san05',
 10  'ORCL:san06'
 11  attribute 'compatible.asm' = '11.2.0.0.0';

Diskgroup created.

ASM> select failgroup,sum(total_mb) from v$asm_disk
  2  where label like 'SAN%' group by failgroup order by failgroup;

FAILGROUP                      SUM(TOTAL_MB)
------------------------------ -------------
FG1                                      510
FG2                                      510
FG3                                      510

Hopefully the above output isn’t surprising because we have created quite a number of disk groups already on the disks used to write this posting. If you managed to follow and understand everything so far the next output should match your expectations:

上面的输出应该不需要我过多解释,一切都符合我们的预期,如果上面所写的所有内容你都已经充分理解,那么下面查询内容的输出不应该让你惊讶:

ASM> select name, state, type, total_mb, free_mb, REQUIRED\_MIRROR\_FREE\_MB req_free, USABLE\_FILE\_MB use_mb
  2  from v$asm_diskgroup where name = 'DEMO';

NAME       STATE       TYPE     TOTAL_MB FREE_MB REQ_FREE USE_MB
---------- ----------- ------ ---------- ------- -------- ------
DEMO       MOUNTED     HIGH         1530    1365      510    285

The 510 listed for REQUIRED_MIRROR_FREE_MB is the size of two disks and not the size of a single failure group. The reason for this is almost the same as for a normal redundancy disk group with only two failure groups, but this time we have a high redundancy disk group with only three failure groups. If one or two failure groups are lost, ASM cannot restore redundancy as that would require at least three working failure groups.

REQUIRED_MIRROR_FREE_MB的值为510MB,它其实是2个磁盘的大小,而不是一个failgroup的大小,理由跟normal冗余具有2个failgroup的磁盘组一样,这一次我们的磁盘组是high冗余三个failgroup,如果一个或两个failgroup丢失,ASM不能够重新满足冗余度的要求。

Below is the calculation for the 285 listed as USABLE_FILE_MB:

下面的是用来计算USABLE_FILE_MB的值的公式:

ASM> select trunc((free_mb - REQUIRED\_MIRROR\_FREE\_MB) / 3) as useable
  2  from v$asm_diskgroup where name='DEMO';

   USEABLE
----------
       285

In summary

REQUIRED_MIRROR_FREE_MB is the amount of free space required to restore redundancy after a failure that ASM can tolerate without affecting data availability. This amount depends on the redundancy level and the number of failure groups in the disk group.

REQUIRED_MIRROR_FREE_MB的值代表了ASM用来重新满足磁盘组定义的冗余度所需要的空间,这个值的大小依赖于磁盘组的冗余度和failgroup的数量。

Normal redundancy disk groups with at least three failure groups require an amount of free space that is equal to the size of a single failure group. Normal redundancy disk groups with only two failure groups require an amount of free space that is equal to the size of a single disk.

具有3个failgroup的normal冗余磁盘组,REQUIRED_MIRROR_FREE_MB的值等于一个failgroup的大小,如果 normal冗余的磁盘组只有2个failgroup,那么REQUIRED_MIRROR_FREE_MB的值将等于一个磁盘的大小而非一个failgroup的大小。

High redundancy disk groups with at least four failure groups require an amount of free space that is equal to the sum of the size of two failure groups. High redundancy disk groups with only three failure groups require an amount of free space that is equal to the sum of the size of two disks.

具有4个failgroup的high冗余磁盘组,REQUIRED_MIRROR_FREE_MB的值等于2个failgroup的大小,如high冗余的磁盘组只有3个failgroup,那么REQUIRED_MIRROR_FREE_MB的值将会是两个磁盘的大小。

USABLE_FILE_MB is the amount of disk space available for storing user data. This amount depends on the total size of the disk group, the disk group redundancy and the amount of required free disk space that ASM needs to restore redundancy after a failure. USABLE_FILE_MB is calculated as follows:.

USABLE_FILE_MB的值代表了总的可用来存储数据的空间,它的值依赖磁盘组的大小,磁盘组的冗余度和REQUIRED_MIRROR_FREE_MB的值,USABLE_FILE_MB的值的计算方法如下:

USABLE\_FILE\_MB = (FREE_MB – REQUIRED\_MIRROR\_FREE\_MB) / [2|3]

译者注:
下图中代表一个具有3个failgroup的Normal冗余的磁盘组。其中每个failgroup:F代表free的空间 ,U代表已经使用的空间。
那么根据上面的假设很容易推断:
(F+U)=一个failgroup的大小
那么3F+3U=总的磁盘组的大小


0C2057F5-1AB0-4484-BC84-731E93FF451D.png

那么当前磁盘组的剩余可用空间是多少呢?
非常好计算=总的磁盘组的大小-3U

接着,毁坏一个failgroup后剩余多少可用空间?
这里我们为了让小白容易理解,继续把这个步骤切成两步:
(总空间-3U)-F ,这个值一个failgroup毁坏后,剩余的空间,这个剩余空间还没考虑这个failgroup上已经使用的空间做RB的所需要的空间。
但是为了满足 冗余度的要求,还是要把U这部分空间给RB掉,那么就是:
(总空间-3U)-F-U,我们做一个转换也就是 (总空间-3U)-(F +U)=Free-一个failgroup大小,最终再根据冗余度除以2或着3,这下子是不是很清晰了?

推荐阅读更多精彩内容