Solved

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

Posted on 2011-03-16
8
512 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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