Increasing the disk space available to a virtual appliance using Logical Volume Management (LVM) in API Gateway version 10.x
search cancel

Increasing the disk space available to a virtual appliance using Logical Volume Management (LVM) in API Gateway version 10.x

book

Article ID: 207378

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

While applying the December 2020 platform patch to the Gateway, there was the following error: (also occur on any patch with mysql 8 update )

2021-01-25T10:23:12.583-0800 INFO    28 com.l7tech.server.processcontroller.patching.PatchServiceApiImpl: Output from patch install: INFO       : for mount point "/" there is "3311067136" bytes available and "4114097157" bytes are required

2021-01-25T10:23:12.592-0800 INFO    28 com.l7tech.server.processcontroller.patching.PatchServiceApiImpl: Output from patch install: ERROR      : installing RPMs requires 4114097157 bytes of space on / mount point but only 3311067136 bytes are available

2021-01-25T10:23:12.596-0800 INFO    28 com.l7tech.server.processcontroller.patching.PatchServiceApiImpl: Output from patch install: Error installing patch: Error executing patch task: non-zero exit code returned from patch install script (returned 1)

 

Environment

API Gateway: 10.X

Cause

The size of MySQL update is greater than the default disk space allocation of the OVA.

Resolution

IMPORTANT - Take a snapshot of the image prior to running these steps

(1) Expand disk space with unused allocations: 

Follow the steps in VMWARE KB to add hard disk the space of vg00-lv_root: Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)

(2) Check Disk 

# fdisk -l

Disk /dev/sda: 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: 0x000b0670

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   125829119    61864960   8e  Linux LVM

(3) Start the disk partitioning tool and target the newly installed disk: 

# fdisk /dev/sdb

This command opens up a new command shell. Options are selected by choosing the appropriate alphanumeric option and pressing the <Enter> key

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): p

Disk /dev/sda: 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: 0x000b0670

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   125829119    61864960   8e  Linux LVM

Command (m for help): n

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): p

Partition number (3,4, default 3): 3

First sector (125829120-209715199, default 125829120):  Return

Using default value 125829120

Last sector, +sectors or +size{K,M,G} (125829120-209715199, default 209715199): Return

Using default value 209715199

Partition 3 of type Linux and of size 40 GiB is set

Command (m for help): t

Partition number (1-3, default 3): 3

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'

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)

Syncing disks.

(4) REBOOT

# fdisk -l

Disk /dev/sda: 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: 0x000b0670

(5) Extends physical volume

# vgextend vg00 /dev/sda3

  Volume group "vg00" successfully extended

(6) Command to get Volume Group

# vgdisplay

  --- Volume group ---

  VG Name               vg00

  System ID

  Format                lvm2

  Metadata Areas        2

  Metadata Sequence No  12

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                10

  Open LV               9

  Max PV                0

  Cur PV                2

  Act PV                2

  VG Size               98.99 GiB

  PE Size               4.00 MiB

  Total PE              25342

  Alloc PE / Size       15103 / <59.00 GiB

  Free  PE / Size       10239 / <40.00 GiB

  VG UUID               Me3yGi-2H3m-PRqK-BNpO-BGfy-pDQT-S6ycub

(7) Command to get Logical Volume name(lv_root)  & Volume Group name (vg00)

# lvdisplay

  --- Logical volume ---

  LV Path                /dev/vg00/lv_root

  LV Name                lv_root

  VG Name                vg00

  LV UUID                UqQRvT-7SKj-Qmdu-xNfG-wcNU-r6nn-DAAEYu

  LV Write Access        read/write

  LV Creation host, time dhcp-10-175-245-93, 2020-03-19 18:35:04 -0400

  LV Status              available

  # open                 1

  LV Size                8.00 GiB

  Current LE             2048

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:0


(8) Check Free space 

# vgdisplay vg00 | grep "Free"

  Free  PE / Size       10199 / <39.84 GiB

(9) Extend Logical volume

# lvextend -L +39GB /dev/vg00/lv_root

  Size of logical volume vg00/lv_root changed from <8.16 GiB (2088 extents) to <47.16 GiB (12072 extents).

  Logical volume vg00/lv_root successfully resized.

(10) Expand filesystem Centos use command “resize2fs”

# resize2fs /dev/vg00/lv_root

resize2fs 1.42.9 (28-Dec-2013)

Filesystem at /dev/vg00/lv_root is mounted on /; on-line resizing required

old_desc_blocks = 1, new_desc_blocks = 3

The filesystem on /dev/vg00/lv_root is now 12361728 blocks long.

(11) Recheck SPACE new size 40GB

# df -h

Filesystem                 Size  Used Avail Use% Mounted on

devtmpfs                   2.0G     0  2.0G   0% /dev

tmpfs                      2.0G     0  2.0G   0% /dev/shm

tmpfs                      2.0G  9.1M  2.0G   1% /run

tmpfs                      2.0G     0  2.0G   0% /sys/fs/cgroup

/dev/mapper/vg00-lv_root    47G  4.8G   40G  11% /

/dev/sda1                  976M   70M  855M   8% /boot

/dev/mapper/vg00-lv_home   4.8G  1.4G  3.2G  31% /home

/dev/mapper/vg00-lv_var    2.9G   92M  2.7G   4% /var

/dev/mapper/vg00-lv_tmp    6.8G   17M  6.4G   1% /tmp

/dev/mapper/vg00-lv_log    2.0G  4.5M  1.9G   1% /var/log

/dev/mapper/vg00-lv_db      21G  279M   20G   2% /var/lib/mysql

/dev/mapper/vg00-lv_opt    6.8G  1.9G  4.6G  30% /opt

/dev/mapper/vg00-lv_audit  2.0G  4.6M  1.9G   1% /var/log/audit

tmpfs                      396M     0  396M   0% /run/user/1006

tmpfs                      396M     0  396M   0% /run/user/1005

tmpfs                      396M     0  396M   0% /run/user/1001

tmpfs                      396M     0  396M   0% /run/user/1002

(12) Apply the same patch again

You have chosen to install the following patch

" Layer7_API_PlatformUpdate_64bit_v10.X-CentOS-2020-12-21 "

Press [Enter] to continue

Please wait while the patch is installed ...

Patch ID Layer7_API_PlatformUpdate_64bit_v10.X-CentOS-2020-12-21 (Upgrades the Layer7 API 64bit Platform to the 10.X-CentOS-2020-12-21 version. This patch requires that the 10.X Platform Update be installed first. It also requires a restart of the Layer7 API Gateway Appliance.) is INSTALLED, last modified on 2021-01-27T12:25:51-0500

Patch operation completed successfully.

 

Additional Information

Also occurred when installed Layer7_API_PlatformUpdate_64bit_v10.1.00-CentOS

Article used to solve partition /var/lib/mysql at 100% full wont start

Once expanded and mysql start 

Access mysql and purge audit table 

mysql>mysql -u root -p

mysql >use ssg

SET FOREIGN_KEY_CHECKS = 0;

truncate table audit_admin;

truncate table audit_detail;

truncate table audit_detail_params;

truncate table audit_main;

truncate table audit_message;

truncate table audit_system;

SET FOREIGN_KEY_CHECKS = 1;

 

analyze table ssg.audit_admin;

analyze table ssg.audit_detail;

analyze table ssg.audit_detail_params;

analyze table ssg.audit_main;

analyze table ssg.audit_message;

analyze table ssg.audit_system;