Tuesday, May 31, 2016

Oracle ASM extend Diskgroup

Hello,

here are the steps to drop and re-create the disk group

check the disk size (it's 50 gb)


[root@rac1 ~]# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   15G  0 disk
└─xvda1 202:1    0   15G  0 part /
xvdf    202:80   0   50G  0 disk
└─xvdf1 202:81   0   50G  0 part /u01
xvdg    202:96   0  200G  0 disk
└─xvdg1 202:97   0   50G  0 part
xvdh    202:112  0  200G  0 disk
└─xvdh1 202:113  0   50G  0 part
xvdi    202:128  0   50G  0 disk
└─xvdi1 202:129  0   50G  0 part
xvdj    202:144  0   50G  0 disk
└─xvdj1 202:145  0   50G  0 part
xvdk    202:160  0   16G  0 disk [SWAP]
xvdl    202:176  0  200G  0 disk
└─xvdl1 202:177  0  200G  0 part
xvdm    202:192  0  200G  0 disk
└─xvdm1 202:193  0  200G  0 part
xvdn    202:208  0  150G  0 disk
└─xvdn1 202:209  0  150G  0 part /u04
[root@rac1 ~]# parted /dev/xvdg


Disk size is 200gb but allocated size/partition size is 50gb only.

Step:
1. Drop the current disk group
2. re-create partition
3. update disk UUID into dev rule
4. create a disk group with new size.

1. Drop the current disk group

SQL> alter diskgroup data mount;

Diskgroup altered.

SQL> drop diskgroup data;

Diskgroup dropped.

## Check disk is empty now.

set linesize 180

col path for a50
select path,header_status from v$asm_disk;

PATH                                               HEADER_STATU
-------------------------------------------------- ------------
/dev/oracleasm/disk01                              FORMER
/dev/oracleasm/disk02                              FORMER
/dev/oracleasm/disk06                              MEMBER
/dev/oracleasm/disk04                              MEMBER
/dev/oracleasm/disk05                              MEMBER
/dev/oracleasm/disk03                              MEMBER



Note: ASM does not allow to drop disk group if it's not mounted.


2. re-create partition
#create partation
parted /dev/xvdm
mktable gpt
mkpart asmpart1 0% 100%
quit


After paration:
[root@rac1 ~]# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   15G  0 disk
└─xvda1 202:1    0   15G  0 part /
xvdf    202:80   0   50G  0 disk
└─xvdf1 202:81   0   50G  0 part /u01
xvdg    202:96   0  200G  0 disk
└─xvdg1 202:97   0  200G  0 part
xvdh    202:112  0  200G  0 disk
└─xvdh1 202:113  0  200G  0 part
xvdi    202:128  0   50G  0 disk
└─xvdi1 202:129  0   50G  0 part
xvdj    202:144  0   50G  0 disk
└─xvdj1 202:145  0   50G  0 part
xvdk    202:160  0   16G  0 disk [SWAP]
xvdl    202:176  0  200G  0 disk
└─xvdl1 202:177  0  200G  0 part
xvdm    202:192  0  200G  0 disk
└─xvdm1 202:193  0  200G  0 part
xvdn    202:208  0  150G  0 disk
└─xvdn1 202:209  0  150G  0 part /u04


3. update disk UUID into dev rule


# get UUID one by one and create file
[root@rac1 ~]# udevadm info --query=property /dev/xvdg1 | grep ID_PART_ENTRY_UUID
ID_PART_ENTRY_UUID=ad4b9fef-a590-480f-baef-627b1ef773a4
[root@rac1 ~]#  udevadm info --query=property /dev/xvdh1 | grep ID_PART_ENTRY_UUID
ID_PART_ENTRY_UUID=a12f74db-fdda-491c-b65d-680da0581251

cat > /etc/udev/rules.d/99-oracle-asmdevices.rules <<EOF
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="ad4b9fef-a590-480f-baef-627b1ef773a4", SYMLINK+="oracleasm/disk01", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="a12f74db-fdda-491c-b65d-680da0581251", SYMLINK+="oracleasm/disk02", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="8fa30be3-244e-4f53-af2c-8d9db1492b58", SYMLINK+="oracleasm/disk03", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="4885524d-4b7a-48ee-aca3-2c90d804bf79", SYMLINK+="oracleasm/disk04", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="560d278a-22b6-4afe-9a3e-63d568b27f26", SYMLINK+="oracleasm/disk05", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="xvd??", ENV{ID_PART_ENTRY_UUID}=="627edeac-5dbc-41b4-b36e-475277b43722", SYMLINK+="oracleasm/disk06", OWNER="oracle", GROUP="dba", MODE="0660"
EOF

## Validate that disks are visible

[root@rac1 ~]# ls -al /dev/oracleasm/*
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk01 -> ../xvdg1
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk02 -> ../xvdh1
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk03 -> ../xvdi1
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk04 -> ../xvdj1
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk05 -> ../xvdl1
lrwxrwxrwx. 1 root root 8 Jul 30 15:56 /dev/oracleasm/disk06 -> ../xvdm1


4. create a disk group with new size.

 CREATE DISKGROUP RECO1 EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disk01','/dev/oracleasm/disk02';

# Check  diskgroup

[grid@rac1 ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576    409596   219377                0          219377              0             N  DATA1/
MOUNTED  EXTERN  N         512   4096  1048576    409596   409542                0          409542              0             N  RECO1/
MOUNTED  NORMAL  N         512   4096  1048576    102396   100412                0           50206              0             N  REDO/


Note: I am droppping the diskgroup here so be c

apt-key warning when sudo apt update run

Issue: apt-key warning when sudo apt update run Update below file: cat /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list ...