Adsense Code

Tuesday, 1 September 2015

vSphere Server appliance using up lots of disk space and how to tidy it up

I had a problem where the vCenter Server appliance that we use ended up with very full disks.  First of all, and as you may have gleamed from other previous blogs, I got around this by extending disks and migrating data around.

But this just keeps the wolf from the door!  I logged a call with VMWare and they were referred me to this article which is great in that it stops the issue from getting any worse but it doesn't tidy up the woe that has been left behind.

So what do you do?

Maybe do a clone of your vCenter appliance for an immediate backup.

Find out which host is running your vCenter appliance and then connect directly to the host with a vSphere client as you are about to bring your vcenter environment down.

Login to the console your direct vcenter appliance now.

Type in

service vmware-vpxd stop


service vmware-vpostgres stop

Type the following command in make a copy of the original postgresql.conf file (all one entry)

cp /storage/db/vpostgres/postgresql.conf /storage/db/vpostgres/postgresql.conf.orig

So now we need to edit postgresql.conf - the VMware article says with a text editor, I used vi which is on the appliance but I have also included instructions for vi as I come a from a Windows background and whilst I have come to enjoy vi's quirks - when there are big issues going on, you don't want to faff about!

vi /storage/db/vpostgres/postgresql.conf

Page down and using the cursor keys scroll down to line 312 where you want to edit the log_min_messages = error line

Press the insert key and now you are editing the config file!

Delete the first hash/number so that the config file will be read and then delete the word warning and replace with the word error.

Now press the escape key and now you are not editing the file.

Press colon and then w and then press enter - you'll see in the bottom left of the screen a


Pressing enter saves the file because you have just written the file (hence the w) 

Press colon again and then q and then press enter


This will allow you to quit (hence the q....)

But now we need to delete the old excess data - change to the directory where all the excess data

cd /storage/db/vpostgres/pg_log

Then this gem of a command that I found which deletes EVERYTHING in that directory except for the 5 most recent files.

rm `ls -t | awk 'NR>5'`

On my British keyboard within the VM console, to get a pipe, | , I need to press Shift and ~ over by the main enter key.

If you have run out of space drastically, you will then have a lot of data to delete.  So this command can actually take a while to run.  Monitor it on your graphs as you do have a direct connection to the host that is running your vCenter appliance after all.

Now you just need to get vCenter back up and running.

service vmware-vpostgres start

and then

service vmware-vpxd start 

No comments:

Post a Comment