Re: database on selected disk

From: Zahid Rahman <zahidr1000(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: database on selected disk
Date: 2021-10-19 11:59:08
Message-ID: CAPGSW3Qp_8CbNau8Ae2baE52_qv2VTwsXdx3E3eXYmGyWYE9kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks.
I had a bit of luck with searching around.

I think if I create a TABLESPACE and point that to any disk partition or
mount point

CREATE TABLESPACE tablespace_name OWNER user_name LOCATION directory_path;

then when creating a database or even a table I just need to include the
TABLESPACE name .

CREATE DATABASE logistics TABLESPACE ts_primary;

This will allow me to use the secondary disk for purely databases.

Thanks

On Tue, 19 Oct 2021, 06:51 Holger Jakobs, <holger(at)jakobs(dot)com> wrote:

> Am 18.10.21 um 19:04 schrieb Zahid Rahman:
> > Hi
> >
> > I have two disks attached to my Raspberry pi 4 .
> >
> > One disk is a 2TB with a partition called postgres on /dev/sdb/sd1 .
> > When creating databases this is where I wish to create them.
> >
> > This is not the disk with the operating system installed .
> > If I install postgres with pgadmin using apt install,
> > any database I create will be installed on disk /dev/sda/sda1 by
> default.
> >
> > Can you please give me a HOW-TO on choosing the partition on a
> > particular disk when creating a database or perhaps even a table.
> >
> > Thanks
> > Zahid
> >
> >
> Hi Zahid,
>
> when setting up a database cluster with initdb, you determine the
> directory path for the cluster.
>
> So make sure the directory path resides on the disk you want it to be.
>
> What is also possible is using a symbolic link to redirect to another
> directory on the intended disk.
>
> On the other hand, it's not possible to have some databases of a cluster
> on one drive and some on another. A database cluster cannot be
> distributed among disks.
>
> Since you can have any number of database clusters on a machine, this
> doesn't impose a problem.
>
> Regards,
>
> Holger
>
> --
> Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message satish v 2021-10-19 16:48:21 Renaming 800GB size table in postgresql
Previous Message Paul Smith 2021-10-19 08:26:27 Re: database on selected disk