PostgreSQL on Multiple HDD Partitions – Single Base Setup

postgresql

Imagine a situation:

  1. I got a Postgres database working on single server on one of HDD partitions (partition size 100GB)
  2. Database grows up to 100GB taking whole free place on the partition
  3. Database stops working because of none free space on HDD

What do I need to do in situation when Postgres database will occupy 100% of partition that the database is on?
Can I move the Postgres database into multiple HDD partitions which there will be similar amount of data on all of them?

If it's possible, how to do that?

Best Answer

The easy answer is "don't do that".

You can define multiple table-spaces for PostgreSQL to use, and put them on different partitions. But once you've completely run it out of space, that is hard to do. And if you are planning ahead, it would generally be better to just make your partitions larger to start with, using RAID to make them even larger than a single disk.