1

I have a debian installed server, where I have used apt to install pgsql9.4 a few months ago. Now, after a month, I see that the folder totals to 19GB:

/var/lib/postgresql/9.4/main

is taking up all my space of rootfs (19GB). Agreed, I am writing some heavy UTf-8 stuff onto the instance.

It is probably daft to ask, but, is there a way I can move this folder/installation in postgres to another disk? and still not affect my db? Can this be even done?

1 Answer 1

5

Sure you can.

  1. Stop the PostgreSQL server.

    /etc/init.d/postgresql stop

  2. Move the data directory somewhere else.

    mv /var/lib/postgresql/9.4/main /storage/ssd/

  3. Make a symlink pointing to the new location.

    ln -s /storage/ssd/main /var/lib/postgresql/9.4/main

  4. Start the PostgreSQL server.

    /etc/init.d/postgresql start

Sign up to request clarification or add additional context in comments.

1 Comment

Wow.. that was simple.. I thought it would be complicated! Thanks so much.. Works like a charm.. :) Accepted your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.