VCSA database storage "/storage/db" is full or nearly full
search cancel

VCSA database storage "/storage/db" is full or nearly full

book

Article ID: 318880

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides steps to allow the application to continue to function while giving steps to allow reduce the footprint of the database on disk.

Symptoms:
  • In the /var/log/vmware/vpxd/vpxd.log file, you see entries similar to:
No Space left on device
  • In the /storage/db/vpostgres/pg_log/postgresql.log file, you see entries similar to:

    psql.bin:  could not extend file "pg_tblspc/16392/PG_9.4_201409291/16385/8126296": No space left on device
  • Running df -h, you see entries similar to:
50G 50G 0G 100% /storage/db

Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.  

For more information about log files, see Location of vCenter Server log files (1021804).


Environment

VMware vCenter Server Appliance 6.5.x
VMware vCenter Server Appliance 6.7.x
VMware vCenter Server 7.0.x

VMware vCenter Server 8.0.x

Cause

Most likely the database is holding redundant data. The redundant data that the database is holding is referred to as bloat. 

Bloat can be caused by a variety of reasons:

  • Bugs in applications which connect to the database
  • Long running idle transactions
  • Internal database processes not aggressive enough to do database housekeeping.
  • VCSA OS has lost control of the thread of the automatic database clean-up utility process

Resolution

  1. Reboot the vCenter Server

This will resolve any problem with lost process threads.
  1. Note the percentage space full you saw when running df -h from the command line.
  2. Find if the VCSA virtual machine is managed through another vCenter Server. If the vCenter Server is on a host in the cluster find which ESXi host manages the vCenter Server virtual machine. Access the host client by opening a web browser tab to the host web client at https://<host IP or FQDN>.
  3. Open a console window to the VCSA VM.
  4. Select to shut down the guest operating system. Do not power off.
  5. After reboot wait 30 minutes  then run df -h again to check the space available.
  6. If space free is not any better than before, continue with the steps below.

 

  1. Resolving a completely full partitition

    1. If the database disk is 100% full you will have to extend it. The cleanup utility does need some space as overhead to function. Increase the disk size and extend the partition that's full on the df -h output.
    2. To increase the disk size, see Increasing the disk space for the VMware vCenter Server Appliance in vSphere 6.5, 6.7 and 7.0
 
  1. Check for bloat

    1. Download the script attached to this KB 51981_check_bloat.sql
    2. Connect to the DB: /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB
    3. Copy and paste the content of the file and hit enter.
    4. Check the results. If the tbloat column or the ibloat column are >25 then  schedule maintenance to reduce the bloat in this database.
Note: This query looks at table , index structure, and the number of rows in a table, and estimates the minimum size required to hold that data. It then compares this estimate to the actual current size, to estimate bloat.

To determine the top tables taking up space in the VCSA vPostgres, run this query:

SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;

 
  1. Remove the bloat

    1. Stop all the services:
service-control --stop --all
  1. Run the below command to start the vpostgres:
service-control --start vmware-vpostgres
  1. Run the command to connect to postgres service:
/opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB
  1. To rebuild all the tables and indexes on the database:
vacuum full;
 
Note: This command will remove all bloat.
  1. To collect new statistics for the planner to use for optimal performance
vacuum analyze;
  1. To quit from the path:
\q
  1. Run the command to start all the service:
service-control --start --all


Additional Information

vCenter Server Appliance Data Integrity Best Practices

Impact/Risks:

The required service vmware-vpxd will not start and VCSA will be inaccessible through the client.


Attachments

51981_check_bloat get_app