Opt Partition Expansion
Title: Expansion of opt partition in the VM environment.
Category / Product: Skyhigh Secure Web Gateway VM Appliance.
Summary:
This article helps customer to increase the opt partition of SWG without touching the web cache partition. This is possible only in VM based SWG , and will not work on On Prem . /opt directory holds significant importance in the filesystem layout. It provides a designated location for optional software installations, packages , separating them from the core operating system components.
The df -h /opt command displays the size of the /opt directory, how much space is used, and how space of that is available (free), and the location where the /opt directory is mounted.
There could be multiple reasons for /opt to run out of space like user-defined logs, temp files, tracing files etc. It is very normal for MWG to create mwg-core temp files in this directory while it is downloading and scanning files. If this directory is the source of your disk space usage on /opt, it could be that many large files are being downloaded at that time. It can be found in /opt/mwg/tmp direcotory.
In the above Snip we could see the /opt directory used is 44% , at some point it was 100% leading to crash of the appliance. Here Cache Sizing is proper, hence we wont do the cache resizing. Refer the article for Cache Resizing:
Solution
If it is a virtual environment, we can increase the /opt folder when we increase the existing HARDWARE DISK size, say 200 to 220 GB (This is Example) , without rouching Cache Partition
Virtual Environment Steps:
"lsblk shows how many PV and VG are there with corresponding LV."
-
Extend the existing HDD size, say from 200GB to 220GB.
-
Turn on the appliance and enter the terminal
-
Use "cfdisk"
It should show the increased volume size as free in the last -
Use the arrow button and select the free volume. Make one new primary partition, say sda3, and save it.
-
Once done, extend the VG group. using "vgextend vg00 /dev/sda3"
output :
The physical volume "/dev/sda3" was successfully created.
Volume group "vg00" was successfully extended.
i: to check the VG group "vgdisplay"
ii: to check logical volume member "lvdisplay"
iii: to check the physical volume "pvdisplay" -
Once VG is increased, we can increase the opt using "lvextend -L +20G /dev/vg00/opt."
output :
The size of the logical volume vg00/opt changed from 40.08 GiB (10261 extents) to 60.08 GiB (15381 extents).
Logical volume vg00/opt was successfully resized. -
"df -lH" shows the current size.
Note: We can increase the opt partition as needed, but it is recommend to increase based on the HOST (vmware esx).
Monitoring /opt partition as Precautionary Measure:
A best practice for monitoring /opt is to configure alerts to trigger when /opt usage reaches a specific threshold. This can help you avoid problems before they happen. Below are some of our recommended methods to trigger alerts:
-
Incident IDs: Dashboard alerts are presented when the /opt partition usage exceeds 90%.
-
Create a Rule to Monitor and Send Alerts. Policy > Rule Sets > Error Handler > Default > Monitoring rule set.