How to resize a physical disk or LUN and an ASM DISKGROUP
Beware : Please read whole carefully
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;NAME PATH TOTAL_MB FREE_MB
NAME PATH TOTAL_MB FREE_MB
DG1_0000 /dev/raw/raw4 1500 90
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.
*Now these steps are dangerous to perform
Enjoy !!
No comments:
Post a Comment