I have a small ~10G PostgreSQL 8.4 database used for development that has filled up the /var directory and is now unusable. I am unable to connect to the database in this state to delete any data or drop any tables.

I am not concerned about keeping any of the data in the database, but I am unable to run a DROP DATABASE or similar command because I am unable to connect.

What is the best method for 'resetting' my database given this situation?

  • Can't you delete (or temporarily move elsewhere) any other files in the /var partition (e.g. files from /var/log), or alternatively extend the partition (e.g. via LVM)? Once you make enough free space, you could start the service and drop stuff. – Ziggy Crueltyfree Zeitgeister Jun 9 '16 at 6:25
  • @ZiggyCrueltyfreeZeitgeister /var/log/ is actually mounted on a separate partition so deleting those logs will not help. I'm not sure what else in /var/ I can safely delete. – Boo Radley Jun 9 '16 at 13:28
  • I am unable to connect: it's not clear whether your instance is running. If it refuses to start it might help to start in single user mode. If it's already started please share the error messages when trying to connect to it. – Daniel Vérité Jun 9 '16 at 15:40

First I'd have a look around /var/log to see if there are any files I could get rid of. If that's the case, you could then start your service and remove the appropriate databases.

If you do not care of your data, you could drop your cluster with the pg_dropcluster command. Look at the man file for the appropriate options.

And by the way, 8.4 support has ended a while ago (https://www.postgresql.org/support/versioning/) and you shoudl really consider upgrading to a supported version.

  • I resolved this problem by temporarily moving some files from /var/ to another partition. Then I was able to start the database, connect, and drop my tables. Thanks for the help. – Boo Radley Jun 9 '16 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.