Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2011-03-16
8
514 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
ID: 35150284
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
ID: 35150472
Sorry, no space inbetween the PGDATA and = sign
export PGDATA=</partition/DATA folder>

Open in new window

0
 

Author Comment

by:missymadi
ID: 35150760
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 4

Expert Comment

by:Alex Matzinger
ID: 35151104
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
 

Author Comment

by:missymadi
ID: 35201859
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
ID: 35201953
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
ID: 35202253
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
ID: 35202757
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

840 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