6.14.4 Increasing the Size of the Grid Infrastructure Home or Database Home File System
You can increase the size of the Oracle Grid Infrastructure or Oracle Database home file system in a Oracle Linux KVM guest.
The Oracle Grid Infrastructure software home and the Oracle Database software home are created as separate disk image files in the KVM host. The disk image files are located in the /EXAVMIMAGES/GuestImages/DomainName/
directory. The disk image files are attached to the guest automatically during virtual machine startup, and mounted as separate, non-LVM file systems in the guest.
This task assumes that additional disk space is available to be used.
- Connect to the guest, and check the file system size using
the
df
command. For example:# df -h Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/VGExaDbDisk.grid--klone--Linux--x86--64--190000.50.img-LVDBDisk 50G 5.9G 45G 12% /u01/app/19.0.0.0/grid /dev/mapper/VGExaDbDisk.db--klone--Linux--x86--64--190000.50.img-LVDBDisk 50G 6.5G 44G 13% /u01/app/oracle/product/19.0.0.0/DbHome_3 ...
- Connect to the KVM host, and then shut down the guest.In the example, the guest name is
dm01db01vm01.example.com
.# /opt/exadata_ovm/vm_maker --stop-domain dm01db01vm01.example.com
- While still connected to the KVM host, create a reflink copy
to serve as a backup of the disk image that will be increased.
The disk image is located under
/EXAVMIMAGES/GuestImages/GuestName
. The image file name containsgrid
for an Oracle Grid Infrastructure image ordb
for an Oracle Database image. For example:# cd /EXAVMIMAGES/GuestImages/dm01db01vm01.example.com # cp --reflink db19.6.0.0.200114-3.img pre_resize.db19.0.0.img
- In the KVM host, create a new disk image and attach it to the guest.
For example, the following command adds the disk image
db03.img
to the guestdm01db01vm01.example.com
:# /opt/exadata_ovm/vm_maker --create --disk-image /EXAVMIMAGES/db03.img --attach --domain dm01db01vm01.example.com [INFO] Allocating an image for /EXAVMIMAGES/db03.img, size 50.000000G... [INFO] Running 'qemu-img create /EXAVMIMAGES/db03.img 50.000000G '... [INFO] Create label gpt on /EXAVMIMAGES/db03.img. [INFO] Running 'parted -a none -s /EXAVMIMAGES/db03.img mklabel gpt'... [INFO] Running 'losetup -P -f /EXAVMIMAGES/rk02.img'... [INFO] Finding loop device... [INFO] loop device is /dev/loop0 [INFO] Finding number of sectors... [INFO] 104857600 sectors [INFO] Releasing loop device /dev/loop0... [INFO] Removing device maps for /dev/loop0... [INFO] Running 'kpartx -d -v /dev/loop0'... [INFO] Removing loop device /dev/loop0... [INFO] ## [INFO] ## Finished . [INFO] ## [INFO] Created image /EXAVMIMAGES/db03.img [INFO] File /EXAVMIMAGES/GuestImages/dm01db01vm01.example.com/db03.img is a reflink from /EXAVMIMAGES/db03.img and added as disk to domain dm01db01vm01.example.com [INFO] -------- MANUAL STEPS TO BE COMPLETED FOR MOUNTING THE DISK WITHIN DOMU dm01db01vm01 .example.com -------- [INFO] 1. Check a disk with name /dev/VGExaDbDisk.db03.img/LVDBDisk exists. [INFO] - Run the command 'lvdisplay' to verify a disk with name '/dev/VGExaDbDisk.db03.img/ LVDBDisk' exists. [INFO] 2. Create a directory that will to be used for mounting the new disk. [INFO] 3. Add the following line to /etc/fstab: /dev/VGExaDbDisk.db03.img/LVDBDisk <mount_ point_from_step_2> <fstype> defaults 1 1 [INFO] 4. Mount the newly added disk to mount point through the command: mount -a.
Do not perform the manual steps described in the output. However, take note of the logical volume path identified in manual step number 1.
In general, the logical volume path has the form:
/dev/VolumeGroupName/LogicalVolumeName
.In the example, the logical volume path is
/dev/VGExaDbDisk.db03.img/LVDBDisk
. - Restart the guest.For example:
# /opt/exadata_ovm/vm_maker --start-domain dm01db01vm01.example.com --console
- In the guest, confirm the newly added disk device.
Use the
lvdisplay
command along with the logical volume path noted earlier.# lvdisplay /dev/VGExaDbDisk.db03.img/LVDBDisk LV Path /dev/VGExaDbDisk.db03.img/LVDBDisk LV Name LVDBDisk VG Name VGExaDbDisk.db03.img LV UUID u3RBKF-UmCK-JQxc-iFf5-6WqS-GWAw-3nLjdn LV Write Access read/write LV Creation host, time dm01db01vm01.example.com, 2019-10-28 04:11:28 -0700 LV Status available # open 0 LV Size <50.00 GiB Current LE 12799 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:14
- In the guest, remove the logical volume and volume group
that were created for the added disk.You must perform this step in order to use the newly created disk to extend an existing volume group.
- Remove the logical volume.
In this example, the logical volume path is
/dev/VGExaDbDisk.db03.img/LVDBDisk
.# lvremove /dev/VGExaDbDisk.db03.img/LVDBDisk Do you really want to remove active logical volume VGExaDbDisk.db03.img/LVDBDisk? [y/n]: y Logical volume "LVDBDisk" successfully removed
- Remove the volume group that came with the logical volume.
In this example, the volume group name is
VGExaDbDisk.db03.img
.# vgremove VGExaDbDisk.db03.img Volume group "VGExaDbDisk.db03.img" successfully removed
At this point, all that is left is the physical volume with no logical volume and no volume group. - Remove the logical volume.
- In the guest, identify the physical volume device for the
newly added disk.
The physical volume identifies itself as a
NEW Physical volume
inpvdisplay
output. For example:# pvdisplay ... "/dev/sdf4" is a new physical volume of "<50.00 GiB" --- NEW Physical volume --- PV Name /dev/sdf4 VG Name PV Size <50.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID tfb8lM-eHe9-SPch-8UAu-pkHe-dAYx-ru3Sez ...
- In the guest, identify the volume group for the file system
that you want to extend.Use the
vgdisplay
command. The volume group name containsgrid
for Oracle Grid Infrastructure ordb
for Oracle Database. For example:# vgdisplay -s ... "VGExaDbDisk.grid-klone-Linux-x86-64-190000.50.img" <50.00 GiB [<50.00 GiB used / 0 free] "VGExaDbDisk.db-klone-Linux-x86-64-190000.50.img" <50.00 GiB [<50.00 GiB used / 0 free] ...
- In the guest, extend the volume group, then verify the
additional space in the volume group. Use the
vgextend
command and specify the volume group name and physical volume device that you identified previously. For example:# vgextend VGExaDbDisk.db-klone-Linux-x86-64-190000.50.img /dev/sdf4 Volume group "VGExaDbDisk.db-klone-Linux-x86-64-190000.50.img" successfully extended
Use thevgdisplay
command to verify that the volume group now contains some free space. For example:# vgdisplay -s ... "VGExaDbDisk.grid-klone-Linux-x86-64-190000.50.img" <50.00 GiB [<50.00 GiB used / 0 free] "VGExaDbDisk.db-klone-Linux-x86-64-190000.50.img" <101.24 GiB [<50.00 GiB used / <51.24 GiB free] ...
- In the guest, resize the logical volume using the following
lvextend
command:# lvextend -L +sizeG LogicalVolumePath
The following example extends the logical volume by 10 GB:
# lvextend -L +10G /dev/VGExaDbDisk.db-klone-Linux-x86-64-190000.50.img/LVDBDisk
- In the guest, resize the file system partition using the
xfs_growfs
command.# xfs_growfs /u01/app/oracle/product/19.0.0.0/DbHome_3
- In the guest, verify the file system size was increased. For
example:
# df -h Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/VGExaDbDisk.db--klone--Linux--x86--64--190000.50.img-LVDBDisk 60G 6.5G 53G 10% /u01/app/oracle/product/19.0.0.0/DbHome_3 ...
- Connect to the KVM host, and remove the backup image.
Use a command similar to the following where
pre_resize.db19.0.0.img
is the name of the backup image file created in step 3:# cd /EXAVMIMAGES/GuestImages/DomainName # rm pre_resize.db19.0.0.img
Parent topic: Increasing the Disk Space in a Guest