Something I have learned over my career as a consultant is to back up everything before performing an upgrade, and then back it up again another way 🙂 There’s nothing worse than an upgrade going sideways and having no way to back out. Also, if you’re doing any sort of work in an enterprise setting, furnishing a back-out plan before you begin may well be a requirement. This is to ward off extended downtime and potential financial loss as a result. As deploying the vCenter Server Appliance (or whatever we’re calling it now…) becomes the de facto method of deploying vCenter, a Windows admin can sometimes no longer pop into SSMS and fire off a quick backup of the database. Especially as of version 6.0, the embedded vPostgres database is capable of handling quite a large environment, so more folks are opting to use it. As such, I’m going to go over how to grab a backup of it. It’s good practice to do this regularly if you aren’t getting a backup of it another way, and I also recommend doing this before any sort of upgrade (as I’m doing now). Here we go!

First off, SSH to the appliance and log in as root. This backup will be done from the command line.

Next, the vCenter service must be stopped so that the database isn’t being accessed as we back it up.

vCenterServerAppliance:~ # service vmware-vpxd stop Stopping VMware vSphere Profile-Driven Storage Service... Stopped VMware vSphere Profile-Driven Storage Service. Stopping tomcat: success Stopping vmware-vpxd: success Shutting down ldap-server..done

Next, navigate to the directory where the backup utility is located.

cd /opt/vmware/vpostgres/1.0/bin

Display the database configuration file, like so:

vCenterServerAppliance:/opt/vmware/vpostgres/1.0/bin # cat /etc/vmware-vpx/embedded_db.cfg EMB_DB_INSTALL_DIR='/opt/vmware/vpostgres/9.0' EMB_DB_TYPE='PostgreSQL' EMB_DB_SERVER='127.0.0.1' EMB_DB_PORT='5432' EMB_DB_INSTANCE='VCDB' EMB_DB_USER='vc' EMB_DB_PASSWORD='7Uz($Q4tY6' EMB_DB_STORAGE='/storage/db/vpostgres'

Note the instance name and the user credentials. Use those details to formulate the following command. This will perform the database backup.

vCenterServerAppliance:/opt/vmware/vpostgres/1.0/bin # ./pg_dump VCDB -U vc -Fp -c > /tmp/VCDBbackup

The database is now backed up. It’s safe to go ahead and start the vCenter service again.

vCenterServerAppliance:/opt/vmware/vpostgres/1.0/bin # service vmware-vpxd start

We just need to put it in a safe place in case we need it. The contents of the /tmp directory won’t persist through a reboot. So grabbing the backup off the appliance all together in case something goes awry is a good idea. Use WinSCP to connect to the host, and copy the file from /tmp to another machine/file share.

In the event that you need this backup (hopefully you never do!) you can find instructions on restoring it in this KB article (the same one this backup procedure came from).