Re: How to store data on an external drive

From: chen jia <chen(dot)1002(at)gmail(dot)com>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org, jasen(at)xnet(dot)co(dot)nz
Subject: Re: How to store data on an external drive
Date: 2009-09-09 13:05:58
Message-ID: 7c7c17320909090605x767eb1b9t24c4256456a20b69@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Sam,

Thanks for your help. Your solution seems to work. I may let you know
if I run into problems. Thanks again.

Best,
Jia

On Tue, Sep 8, 2009 at 11:31 AM, Sam Mason<sam(at)samason(dot)me(dot)uk> wrote:
>  [ 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/
>

--
Ohio State University - Finance
248 Fisher Hall
2100 Neil Ave.
Columbus, Ohio 43210
Telephone: 614-292-2979
http://www.fisher.osu.edu/~chen_1002/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2009-09-09 15:01:07 Swapped download links for 8.4.1 zip binaries
Previous Message David W Noon 2009-09-09 11:42:31 Re: where clauses and multiple tables