Thread: Running postgres on a read-only file system

Running postgres on a read-only file system

From
"Tyler Mitchell"
Date:
Hi, I couldn't get any good answers off the ADMIN list, can you help me?

I haven't been able to finding information on this, or at least I
haven't known the right keywords to search for.

We are trying to make  a fully contained, CD-runable version of postgres
for advocacy purposes.
The only problem we are really having is the locking of the database files
in the PGDATA folder.  Since the PGDATA folder is going to be on the CD
(i.e. read-only) normal setup prevents us from doing this.  We indeed, only
want to read data and not write.

Can you direct me to either other resources to read or at least point me to
the settings/functionality that I need to learn more about?  Or better yet
could you give me some guidance on how to get around this.  The simpler the
solution the better (i.e. postmaster
options, environment variables, etc.).

Is it possible somehow?

Tyler

p.s. We are testing this on a windows beta but I hope that doesn't make a
difference.




Re: Running postgres on a read-only file system

From
Joe Conway
Date:
Tyler Mitchell wrote:
> Hi, I couldn't get any good answers off the ADMIN list, can you help me?
> 

Or at least not one that you liked, huh ;-)

You won't get a more authoritative answer than you've already gotten.

Joe



Re: Running postgres on a read-only file system

From
"Tyler Mitchell"
Date:
>Tyler Mitchell wrote:
>> Hi, I couldn't get any good answers off the ADMIN list, can you help me?
>>

>Or at least not one that you liked, huh ;-)

Ooops "good" is a relative term. I should phrase it "I couldn't get any
answers that directly met my application needs" :)

I know that I need to at least get some more understanding on the process
that takes place.  But like I said, I don't even really know where to start
and couldn't find anything in the docs (at least using the keywords that
came to mind) to help explain it to me.

>You won't get a more authoritative answer than you've already gotten.

A guy's gotta try :(





Re: Running postgres on a read-only file system

From
Andrew Sullivan
Date:
On Fri, Aug 30, 2002 at 02:08:59PM -0700, Tyler Mitchell wrote:
> 
> I know that I need to at least get some more understanding on the process
> that takes place.  

The problem is that PostgreSQL doesn't have a "read only" mode.  So
you can't really do it this way.

Is there a way to make a RAMDISK on Win32?  If so, Tom Lane's
suggestion is probably the best one.  Set up a RAMDISK, put your data
directory there, and presto.  Of course, that means you need enough
physical memory to hold the database, which might cause problems.

What about using the CD-ROM to copy a version of the database onto
the hard drive?  You could delete it when your application shuts
down, I guess; you'd still need that much free space for your db,
though.

A

-- 
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8                                        +1 416 646 3304
x110



Re: Running postgres on a read-only file system

From
"Tyler Mitchell"
Date:
>On Fri, Aug 30, 2002 at 02:08:59PM -0700, Tyler Mitchell wrote:
>>
>> I know that I need to at least get some more understanding on the
process
>> that takes place.

>The problem is that PostgreSQL doesn't have a "read only" mode.  So
>you can't really do it this way.

Okay, that answers one of my questions, thanks Andrew. Is this something
that others may be interested in?  Is it realistic to ask that it be added
to the TODO list?
What kind of writes occur normally, how does file locking work.  Could you
direct me to other resources on this for postgresql?

>
>Is there a way to make a RAMDISK on Win32?  If so, Tom Lane's
>suggestion is probably the best one.  Set up a RAMDISK, put your data
>directory there, and presto.  Of course, that means you need enough
>physical memory to hold the database, which might cause problems.
>
>What about using the CD-ROM to copy a version of the database onto
>the hard drive?  You could delete it when your application shuts
>down, I guess; you'd still need that much free space for your db,
>though.

Yes, both good ideas, we've been kicking these around.  But we just wanted
to exhaust the possibilities before we "give in" :)

One more idea, is it possible to "fake" a read-write file system.  I.e.
supply the files that postgresql will be looking for? (I know it's a
stretch, but hey, this IS the "hackers" list)  :)

Thanks guys.




Re: Running postgres on a read-only file system

From
Larry Rosenman
Date:
On Fri, 2002-08-30 at 16:34, Tyler Mitchell wrote:
> 
> >On Fri, Aug 30, 2002 at 02:08:59PM -0700, Tyler Mitchell wrote:
> >>
> >> I know that I need to at least get some more understanding on the
> process
> >> that takes place.
> 
> >The problem is that PostgreSQL doesn't have a "read only" mode.  So
> >you can't really do it this way.
> 
> Okay, that answers one of my questions, thanks Andrew. Is this something
> that others may be interested in?  Is it realistic to ask that it be added
> to the TODO list?
> What kind of writes occur normally, how does file locking work.  Could you
> direct me to other resources on this for postgresql?
> 
> >
> >Is there a way to make a RAMDISK on Win32?  If so, Tom Lane's
> >suggestion is probably the best one.  Set up a RAMDISK, put your data
> >directory there, and presto.  Of course, that means you need enough
> >physical memory to hold the database, which might cause problems.
> >
> >What about using the CD-ROM to copy a version of the database onto
> >the hard drive?  You could delete it when your application shuts
> >down, I guess; you'd still need that much free space for your db,
> >though.
> 
> Yes, both good ideas, we've been kicking these around.  But we just wanted
> to exhaust the possibilities before we "give in" :)
> 
> One more idea, is it possible to "fake" a read-write file system.  I.e.
> supply the files that postgresql will be looking for? (I know it's a
> stretch, but hey, this IS the "hackers" list)  :)
The problem is every query wants to write the clog files.....




-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Re: Running postgres on a read-only file system

From
Rod Taylor
Date:
> One more idea, is it possible to "fake" a read-write file system.  I.e.
> supply the files that postgresql will be looking for? (I know it's a
> stretch, but hey, this IS the "hackers" list)  :)

One of the tricks I use for diskless systems is to mount a ramdrive in a
union mount with a read only nfs mount.  This allows filewrites (to the
ram drive) but old originals are retrieved from the ramdrive.

This is done on FreeBSD, but is effective enough for getting a fully
functioning system (yes, Postgresql included).  Takes quite a bit of ram
though.


Perhaps there is a toolkit for windows that can do similar union mounts?