Re: question: knopixx and postgresql on flash drive - Mailing list pgsql-general

From Mark
Subject Re: question: knopixx and postgresql on flash drive
Date
Msg-id 392986.47998.qm@web39614.mail.mud.yahoo.com
Whole thread Raw
In response to question: knopixx and postgresql on flash drive  (Mark <sendmailtomark@yahoo.com>)
List pgsql-general
Here results of what I've done.

Just a note all this was done on 7.4.16:

First of all problems:
1. cannot complete configure on flass drive
./configure --prefix=/media/sda1/app/psql/postgresql-7.4.16/bin
--without-readline

...

configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: linking ./src/backend/port/tas/dummy.s to
src/backend/port/tas.s
ln: creating hard link `src/backend/port/tas.s' to
`./src/backend/port/tas/dummy.s': Operation not permitted
config.status: error: cannot link src/backend/port/tas.s to
./src/backend/port/tas/dummy.s
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: linking ./src/backend/port/tas/dummy.s to
src/backend/port/tas.s
ln: creating hard link `src/backend/port/tas.s' to
`./src/backend/port/tas/dummy.s': Operation not permitted
config.status: error: cannot link src/backend/port/tas.s to
./src/backend/port/tas/dummy.s


2.Then I build the source in knopixx directory. Build was
successfull.
An attempt to init database on flash drive failed:

knoppix@Knoppix:/ramdisk/home/knoppix/test/build/bin$ ./initdb -D
/media/sda1/app/psql/rdata
The files belonging to this database system will be owned by user
"knoppix".
This user must also own the server process.

The database cluster will be initialized with locale C.


creating directory /media/sda1/app/psql/rdata/pg_xlog... ok
creating directory /media/sda1/app/psql/rdata/pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /media/sda1/app/psql/rdata/base/1...
PANIC:  could not link file
"/media/sda1/app/psql/rdata/pg_xlog/xlogtemp.30300" to
"/media/sda1/app/psql/rdata/pg_xlog/0000000000000000" (initialization
of log file 0, segment 0): Operation not permitted
./initdb: line 644: 30300 Aborted                 "$PGPATH"/postgres
-boot -x1 $PGSQL_OPT $BOOTSTRAP_TALK_ARG template1

initdb: failed
initdb: removing data directory "/media/sda1/app/psql/rdata"
knoppix@Knoppix:/ramdisk/home/knoppix/test/build/bin$

However I made it work.



Here the work around:
=====================

tar build and data directories and copied over to flash drive. and
when knopix starts I copied it in any directory and it works

restart knopixx
untar data.tar and build.tar into the same directory (just to make it
easy)

Let's try to run:
knoppix@Knoppix:~/db/build/bin$ psql test
psql: error while loading shared libraries: libpq.so.3: cannot open
shared object file: No such file or directory
knoppix@Knoppix:~/db/build/bin$

Opps! missing library, fixing it by setting LD_LIBRARY_PATH. Since
the old value not (in my case) set doing it like this:
knoppix@Knoppix:~/db/build/bin$ export
LD_LIBRARY_PATH=/ramdisk/home/knoppix/db/build/lib

knoppix@Knoppix:~/db/build/bin$ psql test
Welcome to psql 7.4.16, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

test=# \d
       List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+---------
 public | the  | table | knoppix
      (1 row)

test=# select * from the;
 name
-------
abcde
(1 row)

test=# \q
knoppix@Knoppix:~/db/build/bin$
Note: The table was create before and was a part od data directory.

TA-DA! It works!!!

the build and data didn't took much space:
 2718136 data.tar
14919680 build.tar

OS used: Knopixx 2007-01-04
Kernel: Linux Knoppix 2.6.19
PC Memory 512 MB

This is good enough in my case I probably will re-burn knoppix CD to
include those two tar files - just need to find how, but this is a
different story.

It loos like tar-ing data directory does the work for keeping data
stored back to flash drive, however pg_dump is also can be used.

So, the only problem I had was with creating links and if anybody has
an idea how it can be fixed, can you let me know.

Cheers!
Mark

--- Merlin Moncure <mmoncure@gmail.com> wrote:

> On 3/28/07, Mark <sendmailtomark@yahoo.com> wrote:
> > Hi Merlin,
> > Can you point where I can find build instructions for 7.4.X?
> > or in which sequence I should build sources from
> > http://www.postgresql.org/ftp/source/v7.4.16/
> >
> > Thanks a lot,
> > Mark
> > --- Merlin Moncure <mmoncure@gmail.com> wrote:
> >
> > > On 3/28/07, Mark <sendmailtomark@yahoo.com> wrote:
> > > > Ideally, I'd like to have all postgresql related files on
> flush
> > > > drive. and OS on another device (CD). Database data will be
> small
> > > and
> > > > I don't think I will run into the problem with a space.
> > > >
> > > > But how can I install postgresql (including all libraries) on
> > > flash
> > > > drive? I remember that 7.4.X rpms always get installed into
> /usr
> > > > which is ramdrive in my case. Is it possible?
> > >
> > >
> > > Install from source.  You get to omit ssl which you probably
> dont
> > > need
> > > and set the prefix in the configure statement...you will need
> to
> > > set
> > > up your own startup script though, add the binaries to the path
> > > yourself, and set your own PGDATA.
>
> it's easy...download, untar sources
> ./configure [--prefix=/xyz]
> make
> make install
>
> whatever your reasoning for 7.4, overrule them and get something
> more modern :-)
>
> merlin
>




____________________________________________________________________________________
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

pgsql-general by date:

Previous
From: Mike Charnoky
Date:
Subject: Re: disable/enable trigger hangs
Next
From: Tom Lane
Date:
Subject: Re: Btree indexes, large numbers and <= comparisons