Search Postgresql Archives

Re: How to store data on an external drive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> 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/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux