6.13.1.2 Expanding Swap Space on a Guest Using Exascale Storage
You can expand the disk space on an Oracle Linux KVM guest that uses an Exascale system volume, then use the added capacity to create and enable additional swap space.
This procedure follows the same general flow as the related Oracle Exadata procedure for expanding guest disk space backed by Exascale storage: identify the guest disk, expand the Exascale volume, resize the disk visible to the running guest, update the guest partition and LVM physical volume, then verify the result.
- On the KVM host, identify the Exascale system volume used by the guest.
Run the following command on the KVM host, specifying the name of the guest that you want to modify. In this example, the guest domain name is
exa01adm01vm01.example.com.[root@exa01adm01 ~]# vm_maker --list --disk-image --domain exa01adm01vm01.example.com --detail Type Path Target Block /dev/exc/exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc sda ...In the output, locate on the system volume, which contains
_sys_in the disk device name. Take note of the following information, which you will require throughout the rest of the procedure:-
The guest disk target name (
sda). -
The Exascale disk device path (
/dev/exc/exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc). -
The disk image name embedded in the device path (
exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc). -
The Exascale volume ID embedded in the device path (
vol0019_acb70712ce824e8fbfef0205a05dd5fc).
Note:
The command examples in the rest of this procedure use the example values shown in this step. Ensure that you replace these values with your own as needed when running the commands.
-
- On the KVM host, confirm the current disk size.
Run the following commands and confirm that the outputs show the same current disk size (in bytes).
[root@exa01adm01 ~]# virsh domblkinfo exa01adm01vm01.example.com sda Capacity: 109521666048 Allocation: 104065961984 Physical: 109521666048 [root@exa01adm01 ~]# blockdev --getsize64 /dev/exc/exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc 109521666048 - In Exascale, verify and expand the volume.
- Connect to the Exascale command line interface (ESCLI) as the storage administrator or volume owner.
- Confirm the current size of the Exascale volume.
For example:
@>lsvolume vol0019_acb70712ce824e8fbfef0205a05dd5fc --attributes id,name,size,state id name size state vol0019_acb70712ce824e8fbfef0205a05dd5fc exa01adm01vm01_sys 102.0000G AVAILABLENote:
109521666048 bytes = 102 GB
- Expand the Exascale volume.
For example, the following command sets the volume size to 120 GB.
@>chvolume vol0019_acb70712ce824e8fbfef0205a05dd5fc --attributes size=120G Volume altered.
- Resize the disk on the KVM host.
On the KVM host, run the
vm_makercommand with the--resizeoption. Identify the disk (--disk) using the disk image name observed on the KVM host and specify the guest name (--domain).For example:
[root@exa01adm01 ~]# vm_maker --resize --disk exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc --domain exa01adm01vm01.example.com [INFO] Running 'virt-control blockresize exa01adm01vm01.example.com /dev/exc/exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc 128849018880B'... [INFO] Disk image /dev/exc/exa01adm01vm01_sys_vol0019_acb70712ce824e8fbfef0205a05dd5fc resized to 120G - In the guest, expand the system volume.
Use the following command sequence, substituting in your earlier gathered device details.
- Examine the system disk and confirm its size.
[root@exa01adm01vm01 ~]# lsblk -o NAME,TYPE,SIZE,FSTYPE,LABEL,MOUNTPOINT /dev/sda NAME TYPE SIZE FSTYPE LABEL MOUNTPOINT sda disk 120G |-sda1 part 512M xfs BOOT /boot |-sda2 part 256M `-sda3 part 98.6G LVM2_member |-VGExaDb-LVDbSys1 lvm 15G xfs DBSYS / |-VGExaDb-LVDbVar1 lvm 2G xfs VAR /var |-VGExaDb-LVDbVarLog lvm 18G xfs DIAG /var/log |-VGExaDb-LVDbHome lvm 4G xfs HOME /home |-VGExaDb-LVDbSys2 lvm 15G xfs |-VGExaDb-LVDbSwap1 lvm 16G swap SWAP [SWAP] |-VGExaDb-LVDbTmp lvm 3G xfs TMP /tmp |-VGExaDb-LVDbVar2 lvm 2G xfs |-VGExaDb-LVDbVarLogAudit lvm 1G xfs AUDIT /var/log/audit |-VGExaDb-LVDbKdump lvm 20G xfs KDUMP /crashfiles `-VGExaDb-LVDoNotRemoveOrUse lvm 2.6GAt this point, the disk (
sda) should reflect the updated size (120G), but the LVM partition (sda3) has not been expanded to use the added space. - Determine if the device uses a GUID Partition Table (GPT) and update it if necessary.
-
Run the following command to determine if the device uses GPT:
[root@exa01adm01vm01 ~]# blkid -o value -s PTTYPE /dev/sda gptIf the command output indicates that the device does not use GPT, skip to "Extend the LVM partition into the expanded device space."
-
If output of the previous command indicates that the device uses GPT, run the following commands to update the partition view in the OS kernel:
[root@exa01adm01vm01 ~]# printf "Fix\nYes\n" | parted ---pretend-input-tty /dev/sda print Warning: Not all of the space available to /dev/sdd appears to be used, you can fix the GPT to use all of the space ... [root@exa01adm01vm01 ~]# partprobe /dev/sda
-
- Extend the LVM partition into the expanded device space:
[root@exa01adm01vm01 ~]# parted -s /dev/sda "resizepart 3 100%" - Ensure that the OS kernel is aware of the partition change.
[root@exa01adm01vm01 ~]# partprobe /dev/sda [root@exa01adm01vm01 ~]# partx -u /dev/sda - Resize the physical volume:
[root@exa01adm01vm01 ~]# pvresize /dev/sda3 Physical volume "/dev/sda3" changed 1 physical volume(s) resized or updated / 0 physical volume(s) not resized - Verify the free space now available in the LVM partition:
[root@exa01adm01vm01 ~]# pvs -o pv_name,vg_name,pv_size,pv_free PV VG PSize PFree /dev/sda3 VGExaDb <98.55g <18.00g ...
- Examine the system disk and confirm its size.
- In the guest, expand the swap by adding another swap logical volume.
Note:
This procedure expands swap space by adding another logical volume. This approach avoids a scheduled maintenance period and reduces the risk of disrupting workloads in the guest.
Alternatively, you can expand the existing swap device. However, that approach requires taking the existing swap device offline, which may disrupt workloads in the guest.
- Back up the volume group metadata before creating the new logical volume.
[root@exa01adm01vm01 ~]# vgcfgbackup VGExaDb Volume group "VGExaDb" successfully backed up. - Create the new swap logical volume.
In this example, the size of the new swap logical volume is 16 GB.
[root@exa01adm01vm01 ~]# lvcreate -n LVDbSwap2 -L 16G VGExaDb Logical volume "LVDbSwap2" created. - Initialize the logical volume as swap and assign the label
SWAP2.[root@exa01adm01vm01 ~]# mkswap -L SWAP2 /dev/VGExaDb/LVDbSwap2 Setting up swapspace version 1, size = 16 GiB (17179869184 bytes) LABEL=SWAP2, UUID=63825008-90f2-4448-91b4-1ced8a0207c0 - Enable the new swap device immediately.
[root@exa01adm01vm01 ~]# swapon -L SWAP2
- Back up the volume group metadata before creating the new logical volume.
- In the guest, persist the new swap device.
- Back up
/etc/fstab.[root@exa01adm01vm01 ~]# cp -p /etc/fstab /etc/fstab.pre_swap2 - Add the new swap entry.
[root@exa01adm01vm01 ~]# echo "LABEL=SWAP2 swap swap defaults 0 0" >> /etc/fstab - Reload the systemd manager configuration.
[root@exa01adm01vm01 ~]# systemctl daemon-reload
- Back up
- Verify the final configuration.
- Verify that both swap devices are active.
[root@exa01adm01vm01 ~]# swapon --show NAME TYPE SIZE USED PRIO /dev/dm-8 partition 16G 0B -2 /dev/dm-14 partition 16G 0B -3 - Verify the swap logical volumes.
[root@exa01adm01vm01 ~]# lvs VGExaDb | grep Swap LVDbSwap1 VGExaDb -wi-ao---- 16.00g LVDbSwap2 VGExaDb -wi-ao---- 16.00g - Verify the persistent swap entries in
/etc/fstab.[root@exa01adm01vm01 ~]# grep -n swap /etc/fstab 3:LABEL=SWAP swap swap defaults 0 0 14:LABEL=SWAP2 swap swap defaults 0 0
- Verify that both swap devices are active.