Realizando resize do filesystem “/u01” no Exadata

Realizando resize do filesystem “/u01” no Exadata

Objetivo

Realizar o resize do filesystem “/u01”. O volume estendido “/u01” não exigirá nenhum tempo de inatividade (Downtime).

 

Primeiramente temos que fazer a Inclusão de Disco:

1) Acesse o servidor físico exadatadm01

Na máquina física exadatadm01 temos duas máquina virtuais exadatadm01vm01 e exadatadm01vm02.
A máquina virtual que iremos realizar o resize do filesystem “/u01” é o exadatadm01vm01.

[root@exadatadm01 ~]# cd /EXAVMIMAGES/GuestImages/exadatadm01vm01/

2) Liste os discos que possuem o padrão de nomenclatura pv[x]_vgexadb.img.

[root@exadatadm01 exadatadm01vm01]# ls -lah pv*.img
-rw-r----- 1 root root 62G Jun 12 02:11 pv1_vgexadb.img

3) Crie um novo disco com o tamanho desejado e com próximo número da sequência. No caso acima, como o pv1_vgexadb.img é o único criaremos o pv2_vgexadb.img.

[root@exadatadm01 exadatadm01vm01]# qemu-img create /EXAVMIMAGES/GuestImages/exadatadm01vm01/pv2_vgexadb.img 50G
Formatting '/EXAVMIMAGES/GuestImages/exadatadm01vm01/pv2_vgexadb.img', fmt=raw, size=52428800 kB

4) Liste novamente os discos para confirmar a criação.

[root@exadatadm01 exadatadm01vm01]# ls -lah pv*.img
-rw-r----- 1 root root 62G Jun 12 02:11 pv1_vgexadb.img
-rw-r--r-- 1 root root 50G Aug 11 09:48 pv2_vgexadb.img

5) Na VM (user domain) verifique os discos que estão sendo utilizados.

[root@exadatadm01vm01 ~]# lsblk -id
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 25G 0 disk
xvdb 202:16 0 50G 0 disk /u01/app/12.1.0.2/grid
xvdc 202:32 0 50G 0 disk /u01/app/oracle/product/11.2.0.4/dbhome_1
xvdd 202:48 0 62G 0 disk
xvde 202:64 0 50G 0 disk /u01/app/oracle/product/12.1.0.2/dbhome_1

6) No exemplo acima o próximo disco deverá ser o xvdf.

7) De volta ao servidor físico (management domain) execute o comando para anexar (attach) o novo disco criado em modo de leitura/escrita

[root@exadatadm01 exadatadm01vm01]# xm block-attach exadatadm01vm01 file:/EXAVMIMAGES/GuestImages/exadatadm01vm01/pv2_vgexadb.img /dev/xvdf w

8) Na VM (user domain) verifique se o disco foi reconhecido.

[root@exadatadm01vm01 ~]# lsblk -id
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 25G 0 disk
xvdb 202:16 0 50G 0 disk /u01/app/12.1.0.2/grid
xvdc 202:32 0 50G 0 disk /u01/app/oracle/product/11.2.0.4/dbhome_1
xvdd 202:48 0 62G 0 disk
xvde 202:64 0 50G 0 disk /u01/app/oracle/product/12.1.0.2/dbhome_1
xvdf 202:80 0 50G 0 disk

9) Na VM (user domain) particione o novo disco.

[root@exadatadm01vm01 ~]# parted /dev/xvdf mklabel gpt
Information: You may need to update /etc/fstab.
[root@exadatadm01vm01 ~]# parted -s /dev/xvdf mkpart primary 0 100%
Warning: The resulting partition is not properly aligned for best performance.
[root@exadatadm01vm01 ~]# parted -s /dev/xvdf set 1 lvm on

10) Crie o PV da particão.

[root@exadatadm01vm01 ~]# pvcreate /dev/xvdf1
Physical volume "/dev/xvdf1" successfully created

11) Extenda o VG vgexadb.

[root@exadatadm01vm01 ~]# vgextend VGExaDb /dev/xvdf1
Volume group "VGExaDb" successfully extended

12) De volta ao DBServer (management domain) efetue um backup do arquivo de configuração “vm.cfg”.

[root@exadatadm01 exadatadm01vm01]# ls -la *.cfg*
-rw-r----- 1 root root 2517 May 29 09:31 vm.cfg
-rw-r----- 1 root root 2364 Aug 4 2016 vm.cfg.backup

13) No servidor físico (management domain) obtenha o UUID da VM em questão.

[root@exadatadm01 exadatadm01vm01]# grep ^uuid vm.cfg
uuid = 'f5ad54412ae54fab823aa7238bb6a19d'

14) No servidor físico gere um UUID para o disco recém criado.

[root@exadatadm01 exadatadm01vm01]# uuidgen | tr -d '-'
4489c195f6f04d208c40e6e448bb59aa

15) Ainda no servidor físico crie um link simbólico de /OVS/Repositories para a imagem do disco recém criado utilizando o UUID da VM e o UUID gerado para o novo disco.

[root@exadatadm01 exadatadm01vm01]# ln -s /EXAVMIMAGES/GuestImages/exadatadm01vm01/pv2_vgexadb.img /OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/4489c195f6f04d208c40e6e448bb59aa.img net/pv2_vgexadb.img /OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/4489c195f6f04d208c40e6e448bb59aa .img

16) Confirme o que foi feito listando os links.

[root@exadatadm01 exadatadm01vm01]# ls -la /OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/
total 32
drwxr----- 2 root root 4096 Aug 11 11:01 .
drwxr----- 3 root root 4096 Jul 30 2016 ..
lrwxrwxrwx 1 root root 74 Aug 11 11:01 4489c195f6f04d208c40e6e448bb59aa.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/pv2_vgexadb.img
lrwxrwxrwx 1 root root 82 Jul 30 2016 5e8e36a153aa405ca8c5db6b78b1d514.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/grid12.1.0.2.160719.img
lrwxrwxrwx 1 root root 80 Aug 4 2016 8bae1f63c5014993abe0407c90c15d83.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/db12.1.0.2.160719.img
lrwxrwxrwx 1 root root 82 Jul 30 2016 991ab39a87594f5a95428e41d4865f08.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/db11.2.0.4.160719-3.img
lrwxrwxrwx 1 root root 74 Jul 30 2016 a71dc27af60945b3b3963b21fec0e105.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/pv1_vgexadb.img
lrwxrwxrwx 1 root root 69 Jul 30 2016 c8be039d102d413d85ded75cb6f958f9.img -> /EXAVMIMAGES/GuestImages/exadatadm01vm01/System.img

17) No servidor físico edite o vm.cfg incluindo no parâmetro disk a linha abaixo:

'file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/4489c195f6f04d208c40e6e448bb59aa.img,xvdf,w'

ANTES:

disk = ['file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/c8be039d102d413d85ded75cb6f958f9.img,xvda,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/5e8e36a153aa405ca8c5db6b78b1d514.img,xvdb,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/991ab39a87594f5a95428e41d4865f08.img,xvdc,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/a71dc27af60945b3b3963b21fec0e105.img,xvdd,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/8bae1f63c5014993abe0407c90c15d83.img,xvde,w']

DEPOIS:

disk = ['file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/c8be039d102d413d85ded75cb6f958f9.img,xvda,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/5e8e36a153aa405ca8c5db6b78b1d514.img,xvdb,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/991ab39a87594f5a95428e41d4865f08.img,xvdc,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/a71dc27af60945b3b3963b21fec0e105.img,xvdd,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/8bae1f63c5014993abe0407c90c15d83.img,xvde,w','file:/OVS/Repositories/f5ad54412ae54fab823aa7238bb6a19d/VirtualDisks/4489c195f6f04d208c40e6e448bb59aa.img,xvdf,w']

 

Depois desta jornada basta efetuar o resize do LV:

 

1) Identifique o espaço da partição.

[root@exadatadm01vm01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
ext4 24G 16G 7.0G 70% /
/dev/xvda1 ext4 496M 34M 437M 8% /boot
/dev/mapper/VGExaDb-LVDbOra1
ext4 20G 19G 0 100% /u01
/dev/xvdb ext4 50G 16G 31G 34% /u01/app/12.1.0.2/grid
/dev/xvdc ext4 50G 16G 32G 33% /u01/app/oracle/product/11.2.0.4/dbhome_1
/dev/xvde ext4 50G 47G 129M 100% /u01/app/oracle/product/12.1.0.2/dbhome_1
tmpfs tmpfs 196G 42G 154G 22% /dev/shm

2) Verifique se é possível efetuar o resize online da partição com o comando tune2fs.
* A opção resize_inode deve ser listada na saída do comando tune2fs, caso não aparece será necessário desmontar o filesystem antes do resize, consultar documento da Oracle disponível nas referências desse artigo [1].

[root@exadatadm01vm01 ~]# tune2fs -l /dev/mapper/VGExaDb-LVDbOra1 | grep resize_inode
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize

3) Verifique se há espaço livre no VG.

*O VG deve ficar sempre com 1G de espaço livre.

[root@exadatadm01vm01 ~]# vgdisplay -s
"VGExaDb" 136.49 GiB [85.00 GiB used / 51.49 GiB free]

4) Efetuar o resize do LV desejado. Obs: se for partição de sistema o procedimento deve ser feito nos dois LVs.

[root@exadatadm01vm01 ~]# lvextend -L +50G --verbose /dev/mapper/VGExaDb-LVDbOra1
Finding volume group VGExaDb
Archiving volume group "VGExaDb" metadata (seqno 9).
Extending logical volume VGExaDb/LVDbOra1 to 70.00 GiB
Size of logical volume VGExaDb/LVDbOra1 changed from 20.00 GiB (5120 extents) to 70.00 GiB (17920 extents).
Loading VGExaDb-LVDbOra1 table (252:2)
Suspending VGExaDb-LVDbOra1 (252:2) with device flush
Resuming VGExaDb-LVDbOra1 (252:2)
Creating volume group backup "/etc/lvm/backup/VGExaDb" (seqno 10).
Logical volume LVDbOra1 successfully resized
[root@exadatadm01vm01 ~]# resize2fs /dev/mapper/VGExaDb-LVDbOra1
resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/mapper/VGExaDb-LVDbOra1 is mounted on /u01; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 5
Performing an on-line resize of /dev/mapper/VGExaDb-LVDbOra1 to 18350080 (4k) blocks.
The filesystem on /dev/mapper/VGExaDb-LVDbOra1 is now 18350080 blocks long.

Referências

[1] Extending the root LVM Partition on Systems Running Oracle Exadata Storage Server Software Release 11.2.3.2.1 or Later. Available at: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/dbmmn/managing-oracle-vm-domains.html#GUID-37703090-17FE-457E-8201-F2325D18E28B