Re: How to store data on an external drive

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: How to store data on an external drive
Дата
Msg-id 20090908153140.GI5407@samason.me.uk
обсуждение исходный текст
Ответ на How to store data on an external drive  (Jia Chen <chen.1002@gmail.com>)
Ответы Re: How to store data on an external drive  (chen jia <chen.1002@gmail.com>)
Список pgsql-general
 [ please CC the mailing list and not the list owner, they answer
   mailing list questions not PG questions ]

On Tue, Sep 08, 2009 at 10:31:50AM -0400, Jia Chen wrote:
> Sam Mason wrote:
> >I don't think you need to go that far.  I'd just do an "initdb"
> >somewhere on the removable disk and then start PG pointing at where the
> >cluster was (i.e. postgres -D /media/disk/psqldata) and all should be
> >good.  I'd stay away from the official system startup scripts for PG.
>
> If I am not mistaken, the paragraph above means that I don't need to
> reinstall postgresql from source.

Yes; these are all standard programs included with Debian/Ubuntu
packages as normal.  Have a look through the man pages for:

  update-rc.d
  initdb
  postgres

> >Yup, the table data is very tied to the state of transactions and
> >other "system level" information, you need to keep everything together
> >unfortunately.  This is the price of having transactions with ACID
> >semantics.
>
> However, this paragraph implies that I do need to put other "system
> level" information together on the external drive. Do you mean that I
> can put it together without re-installation?  If so, could you offer
> some hints on how to do that? Thanks.

initdb creates a new PG cluster (i.e. the set of files that PG considers
to be a database).  You should direct this to be run on your external
disk and then get PG running using this cluster.  This is what "postgres
-D /media/disk/psqldata" does, i.e. start the postgres server.  Once
it's started you can connect to it from the "normal" clients, psql, odbc
whatever you want.

I expect all you need to run is:

  sudo /etc/init.d/postgresql-8.3 stop
  sudo update-rc.d -f postgresql-8.3 remove
  initdb /media/disk/psqldata
  postgres -D /media/disk/psqldata

from there on, all you need to do is to run the last line when you plug
the drive in.  Before you take the drive out, just hit the normal Ctrl+C
and PG will shutdown cleanly.

--
  Sam  http://samason.me.uk/

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Adding integers ( > 8 bytes) to an inet
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Adding integers ( > 8 bytes) to an inet