Some days ago I faced a problem with out of space on /storage/seat in vCenter Appliance 6.0 in my lab. This is a disk where some vPostgres data are kept: Tasks, Events or Stats. As I described already, you can resize a disk containing /storage/seat. In this post I will show how to purge tables in vCenter database to reclaim space without re-sizing the disk.
To reclaim space please follow the below steps:
- Log in to the VMware vCenter Server Appliance (VCSA) as root using SSH or the console.
Enable VCSA shell:
shell.set --enabled true
Stop vCenter service:
service vmware-vpxd stop
Get password to the vCenter database (between ''):
cat /etc/vmware-vpx/embedded_db.cfg | grep PASSWORD
Enter the following command and then the password you got in the previous step.
/opt/vmware/vpostgres/1.0/bin/psql -d VCDB postgres
Enter the following command to purge tables:
TRUNCATE TABLE vpx_event CASCADE;
The below figure shows results 🙂
service vmware-vpxd start
There is also available a command to clean up vCenter databases:
sudo -u postgres /opt/vmware/vpostgres/9.3/bin/vacuumdb -a -e -v -f -U postgres > /tmp/vacuumdb.log
where 9.3 is your vPostgres version.