Solved

How do I configure Postgres9 to have the database on it's own partition in Linux?

Posted on 2011-03-16
8
510 Views
Last Modified: 2012-05-11
Experts,

        I have a requirement of installing Postgres 9 database on it's own partition in RHEL5.  What are the steps to have DATA on it's own partition?

       I already installed Postgres, do I need to uninstall and reconfigure the software?

 In building the VM, I did designate two hard drives and two ethernet .

Thanks, Missymadi
0
Comment
Question by:missymadi
  • 3
  • 3
  • 2
8 Comments
 
LVL 4

Expert Comment

by:Alex Matzinger
Comment Utility
You should be able to do this by setting the PGDATA environment variable to the partition you want data to be on, and then re initialzing the database.
export PGDATA =</partition/DATA folder>

initdb

pg_ctl start

Open in new window


All done as the postgres user.
0
 
LVL 4

Expert Comment

by:Alex Matzinger
Comment Utility
Sorry, no space inbetween the PGDATA and = sign
export PGDATA=</partition/DATA folder>

Open in new window

0
 

Author Comment

by:missymadi
Comment Utility
I'm new to Linux. Could you point me in the right direction of how to find the hard drive names and a command to find out the size of each. I'm guessing the lesser size of the two is where you would assign the pgdata to?

Thanks, Missymadi
0
 
LVL 4

Expert Comment

by:Alex Matzinger
Comment Utility
The command is df.  

To get a more readable outpt use df -H which will output the resutls into k or M or G depending on the size of the drive. (h = human readable)  ... (you can do the same thing with ls -lh to see the real size of files as well)
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:missymadi
Comment Utility
This is strange. I tried to su postgres and the system is telling me that postgres does not exist?? How did this happen? How can I resolve this?
0
 
LVL 1

Expert Comment

by:data_n_poker
Comment Utility
Check to make sure that the postgres directories are still on the machine.  If they are then try recreting the postgres user with root:
su - root
useradd -p <PASSWORD> postgres

Open in new window

0
 

Author Comment

by:missymadi
Comment Utility
I added postgres back. How could that have happened? We do have custom scripts but I would'nt think that they would want postgres to be disabled or deleted?

Anyway - we do have custom scripts. It looks like our data is captured in a directory
opt/co/DATA   which contains directories, base, global, pg_clog, pg_log, pg_multixact  etc. Is this the DATA directory that I want to point to the separate partition? I did a find on PGDATA and did not find anything.

Thanks, Missymadi
0
 
LVL 1

Accepted Solution

by:
data_n_poker earned 500 total points
Comment Utility
It would appear that perhaps one of your custom scripts erased, or moved the postgres user...not sure how that would happen.  Now just set PGDATA to opt/co/DATA and you should be good to go
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now