Disk space management
This page gives brief overview for actions in case of running out of disk space. Default OpenCRVS server disk layout has large root (/) disk partition with encrypted files mounted as /data folder.
Disk space issues
Root filesystem (/)
/)Reasons:
System upgrades accumulated packages or kernels.
Logs or temporary files filled the disk.
Docker / Kubernetes artifacts accumulated.
Unexpected files written to the root filesystem.
Impact When available disk space drops below 10 GB, Kubernetes will begin stopping containers to protect the node.
This may cause:
OpenCRVS services to stop
Kubernetes pods to be evicted
system upgrades to fail
logging to stop working
Diagnose the issue
Diagnose the issue
If disk encryption is enabled, the /data directory is backed by: /cryptfs_file_sparse.img Do not modify or delete /cryptfs_file_sparse.img.
Check disk usage:
Find large directories:
Common locations to check:
Free disk space
Clean package cache
Remove old kernel versions
List installed kernels and identify old kernes:
Example output:
Remove unused kernels (keep the currently running one):
Example command:
Clean system logs
Check journal size:
Reduce logs:
Clean temporary files
/data partition
/data partitionThis partition stores OpenCRVS application (citizens) data.
Possible reasons
Elasticsearch monitoring and logging indices filled the disk.
Citizen data growth.
Backup files accumulation.
Attachments stored in MinIO.
Impact
When /data is full:
PostgreSQL will produce write errors
OpenCRVS may stop operating
Elasticsearch will stop indexing
Monitoring and logging will break
Diagnose the issue
Check partition usage:
Find largest directories:
Common directories:
/data/elasticsearch, see Elasticsearch disk cleanup
/data/postgres, see PostgreSQL storage
/data/minio, see MinIO storage cleanup
Elasticsearch disk cleanup
Check index sizes:
Delete old indices using:
Kibana Dev Tools, or
Elasticsearch API
Example:
If Elasticsearch APIs are not available:
Stop Elasticsearch
Remove oldest index folders
As a last resort:
This removes all logs and monitoring data.
MinIO storage cleanup
Check size:
Possible actions:
Remove old attachments
Enable MinIO lifecycle rules to automatically delete old objects.
PostgreSQL storage
Check database size:
If PostgreSQL data is the main consumer:
Possible solutions:
Increase
/datapartition size, see Increase /data partitionMove database storage
Disable encryption and expand the partition if needed
Move datastore storage
Default OpenCRVS setup uses host_path storage type and stores all data in /data folder on Kubernetes master node.
OpenCRVS dependencies helm chart has an options to change data location for particular datastore outside of /data folder or on another node:
node_selector: Label(s) to properly select node for data store. All Kubernetes nodes have labelrolewith valuedataX,Xis taken frominfrastructure/server-setup/inventory/<env>.yaml. Value is auto-generated byenvironment:initscript.host_data_path: Path to data folder on the Kubernetes node.
For storage type pvc data location is managed by Kubernetes CSI (storage class) and underlaying persistent storage implementation
An example for MinIO bellow shows how to modify data location for storage_type: host_path, but same configuration options also apply to Elasticsearch and Postgres. In this example MinIO data is stored on fist worker node (data2) instead of default master node (data1):
To change data location on live environment operator (SysAdmin, DevOps) needs to modify helm chart values and copy existing data manually to new location.
Increase /data partition
/data is backed by a file-based encrypted container (/cryptfs_file_sparse.img), the procedure is slightly different from resizing a normal partition. Most safest way is to backup all data from /data partition and then create new larger `/cryptfs_file_sparse.img file.
Digram shows encrypted partition stack:
Use steps with caution
Before resizing an encrypted container:
This protects against catastrophic header corruption.
To increase /data, the typical sequence is:
Increase VM disk
Increase root filesystem
Increase sparse container file:
Resize encrypted device:
Resize filesystem:
Last updated