Este post demonstra um exemplo de expansão de um Diskgroup no ASM redimensionando o ASM disk existente ao invés de adicionar um novo. Aqui temos um único disco de 60 GB e sendo expandido para 100 GB.

Nome do Diskgroup: FPP_REPO

Nome do ASM Disk: FPP1

Nome do disco (e partição) no Linux: /dev/sde1

Assume-se que o disco já foi expandido no storage subjacente (disco virtual da VM, LUN, etc).

1) Verificando tamanho do disco no SO:

# fdisk -l /dev/sde

Disk /dev/sde: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x9b30d185

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1            2048   125829119    62913536   83  Linux

2) Forçando SO a reconhecer o novo tamanho do disco:

# echo "1" > /sys/class/block/sde/device/rescan

3) Verificando disco com novo tamanho de 100 GB:

# fdisk -l /dev/sde

Disk /dev/sde: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x9b30d185

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1            2048   125829119    62913536   83  Linux

4) Recriando a partição, deletando a existente com 60 GB e criando uma nova com o tamanho total do disco (basta aceitar o default).

# fdisk /dev/sde
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

Executando o partprobe:

# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.

5) Alterne para o usuário grid e defina a variáveis de ambiente do Grid Infrastructure com o oraenv:

# su - grid
Last login: Thu Jul  8 21:10:50 -03 2021 on pts/0

$ grep + /etc/oratab
+ASM1:/u01/app/product/19.0.0.0/grid:N

$ . oraenv <<< +ASM1
ORACLE_SID = [grid] ? The Oracle base has been set to /u01/app/grid

6) Acesse a instância ASM:

$ sqlplus / as sysasm

Verificando tamanho atual (Coluna Total_MB):

SQL> ! asmcmd lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     61436    15060                0           15060              0             N  FPP_REPO/
MOUNTED  EXTERN  N         512             512   4096  4194304     30716     6712                0            6712              0             Y  MGMTDB/

7) Executando resize no diskgroup para o ASM usar o novo tamanho reportado pelo SO:

SQL&gt; ALTER DISKGROUP FPP_REPO RESIZE ALL;

Diskgroup altered.

Verifificando o novo tamanho:

SQL&gt; ! asmcmd lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  Y         512             512   4096  4194304    102396    56020                0           56020              0             N  FPP_REPO/
MOUNTED  EXTERN  N         512             512   4096  4194304     30716     6712                0            6712              0             Y  MGMTDB/

Leave a Reply

Discover more from Blog do Dibiei

Subscribe now to keep reading and get access to the full archive.

Continue reading