How to resize a physical disk or LUN and an ASM DISKGROUP

posted Mar 8, 2011, 11:47 AM by Sachchida Ojha
Master Note for Automatic Storage Management (ASM) [ID 1187723.1]
How to resize a physical disk or LUN and an ASM DISKGROUP [ID 311619.1]

Applies to:

Oracle Server - Enterprise Edition - Version: to - Release: 10.1 to 11.1
Generic UNIX
Generic Linux
Generic Windows
***Checked for relevance on 21-Jan-2011***


The purpose of this document is to provide the steps required to resize a physical disk
or LUN at the operating system level and subsequently resize the diskgroup using the new space.

Scope and Application

This document is created for any person involved with ASM administration. 

For this example the storage used is a SCSI storage on Linux Red Hat 3.0 using RAW DEVICES to
simulate the LUN.

How to resize a physical disk or LUN and an ASM DISKGROUP

Resizing a physical disk or LUN and the ASM DISKGROUP

Today most of the storage technology used is SAN or NAS.  The disks in the storage are configured
as a unit (LUN) and presented to the host. When the LUN run out of space, new
disks can be added to the LUN.

In all platforms a LUN is identified in the host as a physical device (disk). The hole LUN can
be used or it can be partitioned. Each partition can be seen as an individual disk.
There are platforms that require a LVM in order to partition a LUN/disk. If a LVM is not used,
then the hole disk needs to be used.

When the space in the LUN is exhausted, in the storage side it is a simple task adding
new disks to the current LUN. Now, it is required the operating system recognize
the new space.

In Linux in order to work on a physical disk, it requires at least one partition. The fdisk command is used
to display and manipulate the partitions.

fdisk -l /dev/sdg returns:

[root@arlnx2 root]# fdisk -l /dev/sdg

Disk /dev/sdg: 9105 MB, 9105018880 bytes
64 heads, 32 sectors/track, 8683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdg1 1 1908 1953776 83 Linux

For this particular example we are using a disk of 9g but only 2gb have been used.

Also a diskgroup has been created using this disk:

SQL> select name,path,total_mb,free_mb from v$asm_disk;









The previous output shows that most of the space has been allocated, so assuming that there are not ASM disks

available, then the LUN will have to be expanded at the OS level and finally at the ASM level resize the diskgroup.

The first step will be adding space to the LUN. In this exercise we are using a DAS (Direct Attached Storage),

using SCSI interface, but on SAN or NAS the steps will be similar.

As we saw in the output of fdisk command, the disk has a capacity of 9gb but only 2gb have been used

for the partition.

In order to use more space, the partition has to be recreated. This operation is at the partition table level,

which is stored in the first sectors of the disk. Changing the partition table is not going to affect the data.

In other words, is extending the partition.

The general steps are:

1. resize LUN from storage
2. pick up new size from OS
3. in rolling fashion, shutdown ASM instances.
4. Only when all ASM have been recycled, you should resize the said disk on 1 ASM instance.

Now, some details/examples to resize the LUN in Linux:

A. Delete the current  partition.
B. Recreate the partition with the new size.

The device /dev/raw/raw4 is attached to the physical disk /dev/sdg.  fdisk command is used to modify the partition table.  Use d to delete the partition, n to create the partition and specify the new size.  Finish the operation using w to write the partition table..

At this point the partition has been configured but it requires the operating system recognize the new size.

When the LUN is ready at the OS level and the ASM instance has been recycled, the next step is resizing the diskgroup at the ASM level:

SQL> alter diskgroup DG1 resize disk dg1_0000 size 8000m;
 Note: this will not trigger a rebalance.
Sachchida Ojha,
Mar 8, 2011, 1:44 PM